p align="left">d,stroka,t1,t2,t3,t4:string; p3,p4:array[1..3]of char; schet,pole3,pole4,errcode:integer; begin kolvo:=0; gotoxy(25,25); textcolor(black); writeln('Input the name of file'); textcolor(white); gotoxy(27,27); readln(d); if d='' then begin clrscr; gotoxy(25,25); writeln('This file does not exists!!!!!!!'); gotoxy(25,26); writeln('Push the -enter- and input name of file again. '); readln; sozdan:=false; exit; end; assign(ft,d); {$I-} reset(ft); if IOResult <>0//проверка есть ли файл then begin clrscr; gotoxy(25,25); writeln('This file does not exists!!!!!!!');//сообщение , что файла нет gotoxy(25,26); writeln('Push the -enter- and input name of file again. ');//ещё раз надо ввести имя файла readln; sozdan:=false;//переменной создания файла присвоить ложь exit; end; sozdan:=true; //переменной создания файла присвоить правда schet:=0; while not EOF(ft) do//цикл пока не конец файла begin while schet<>4 do//пропуск 4 строк begin readln(ft,stroka); schet:=schet+1; end; readln(ft,stroka);//считывание строки t1:=copy(stroka,3,7); t2:=copy(stroka,10,15); {perevod stroki v integer} if stroka[30]= ' ' then t3:=copy(stroka,29,1) else t3:=copy(stroka,29,2); val(t3,pole3,errcode); {perevod stroki v integer} if stroka[42]= ' 'then t4:=copy(stroka,41,1) else t4:=copy(stroka,41,2); val(t4,pole4,errcode); new(newE);..//создание нового эл-та newE^.inf.fio:=t2;//идёт присвоение по полям newE^.inf.nomergrupp:=t1; newE^.inf.propusk:=pole3; newE^.inf.opravdan:=pole4; newE^.nr:=nil; newE^.nl:=nil; left:=newE;Right:=newE; verh:=newE; kolvo:=kolvo+1; {--sozdali 1-iy element} while Not eof(ft) do//покане конец файла begin readln(ft,stroka);//чтение строки if stroka[3]='-'then //сколько знаков не конец ли таблицы exit; t1:=copy(stroka,3,7); //копирывание t2:=copy(stroka,10,15); {perevod stroki v integer} if stroka[30]= ' 'then //сколько знаков не конец ли таблицы t3:=copy(stroka,29,1) else t3:=copy(stroka,29,2); //копирывание val(t3,pole3,errcode); //чтение строки в инт {perevod stroki v integer} if stroka[42]= ' 'then t4:=copy(stroka,41,1) else t4:=copy(stroka,41,2); val(t4,pole4,errcode); {-----sozdanie o4eredi-------------------------------------} pop:=verh; // указатель на на чало while pop<>nil do// цикл пока неконец списка if t2>= pop^.inf.fio//сравнение по фамилиям then pop:=pop^.nr//перевод указателя else break; //прервать цикл new(newE); //создание нового элемента newE^.inf.fio:=t2; newE^.inf.nomergrupp:=t1; newE^.inf.propusk:=pole3; newE^.inf.opravdan:=pole4; if pop=nil then//добавление в конец нового элемента begin right^.nr:=newE; newE^.nl:=right; newE^.nr:=nil; right:=newE; kolvo:=kolvo+1; end else if pop=verh then//добавление в начало begin pop^.nl:=newE; newE^.nr:=pop; newE^.nl:=nil; kolvo:=kolvo+1; verh:=newE; left:=newE; end else begin//добавление в сердину pop^.nl^.nr:=newE; newE^.nl:=pop^.nl; pop^.nl:=newE; newE^.nr:=pop; kolvo:=kolvo+1; end; end; end; right^.nr:=nil; // правый указатель на конкц close(ft);exit// закрытие файла end; {------------------------------------------------------------------------} {------------------prosmotr_2-----------------------------------------} {------------------------------------------------------------------------} procedure prosmotr_2(x:ukaz); var n:integer; c:char; begin clrscr; n:=0; //число выводимых строк newE:=x; //указатель writeln('|------|---------------|----------|---------|-----------|--------|-------|'); writeln('|#grupp| Name | amount of| validly | unvalidly | summa |percent|'); writeln('| | | | absence | | | |'); writeln('|------|---------------|----------|---------|-----------|--------|-------|'); while (newE<>right^.nr) and (n<=6) do//цикл пока не конец списка и число строк =6 begin inc(n); write('|', newE^.inf.nomergrupp:5,' '); //печать данных об элементах по полям write('|',newE^.inf.fio:15); write('|',newE^.inf.propusk:5,' '); write('|', newE^.inf.opravdan:5,' |'); write(newE^.inf.neopravdan:7,' |'); write(newE^.inf.summa:6,' |'); writeln(newE^.inf.procent:5:2,' |'); write('| | | | | | | |'); writeln; newE:=newE^.nr; //перевод указателя end; if otpech=0 then otpech:=otpech+n; writeln('|------|---------------|----------|---------|-----------|--------|-------|'); writeln('Push the -enter- to the ExiT'); //для выхода ентер end; {------------------------------------------------------------------------------} {---------------DOBAVLENIE ELEMENTA--------------------------------------------} {------------------------------------------------------------------------------} procedure dob; var pop:ukaz; p,i:integer; begin gotoxy(25,25); textcolor(red); writeln('Push the -*- to the ExiT'); //для выхода textcolor(white); gotoxy(25,27); writeln('Input the name of a new student'); //ввод имени студента gotoxy(25,28); readln(z.fio); //чтение имени {Uslovie vihoda} if z.fio='*'then//условие выхода exit; for i:=1 to 15-length(z.fio) do//достраиваем имя до 15 знаков z.fio:=z.fio+' '; gotoxy(25,29); //чтение всех данных о студенте с клавиатуры writeln('Input tne nomber of grupp'); gotoxy(25,30); readln(z.nomergrupp); gotoxy(25,31); writeln('Input the omount of absence'); gotoxy(25,32); readln(z.propusk); gotoxy(25,33); writeln('Input the omount of validly absence'); gotoxy(25,34); readln(p); while p>z.propusk do//если число пропусков меньше числа пропусков по уваж причине
Страницы: 1, 2, 3, 4, 5
|