Курсовая работа: Разработка программы обработки экономической информации
{-------------------------------P O I S
K --------------------------------}
{------------------------------------------------------------------------------}
{------------------------------------------------------------------------------}
//смотреть prosmotr_2 –всё аналогично
procedure poisk(x:ukaz;imya:string);
var
n,i:integer;
c:char;
begin
clrscr;
n:=0;
i:=0;
newE:=verh;
while (newE<>right^.nr) do begin//пока
не конец списка
if newE^.inf.fio=imya then
inc(i);
// подсчёт людей с таким именем
newE:=newE^.nr;
end;
if i=0 then begin clrscr;gotoxy(27,25);
textcolor(red);writeln('This student does not EXIST'); exit; end; //такого
нет
newE:=x;
textcolor(white);
textbackground(blue);
writeln('|------|---------------|----------|---------|-----------|--------|-------|');
writeln('|#grupp| Name | amount of|
validly | unvalidly | summa |percent|');
writeln('| | | | absence | | | |');
writeln('|------|---------------|----------|---------|-----------|--------|-------|');
while (newE<>right^.nr) and
(n<=6) do
begin
inc(n);
if newE^.inf.fio=z.fio then
textbackground(red) //выделение элемента красным если это тот
else
textbackground(blue);
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('| | | | | | | |');
textbackground(blue);
writeln;
newE:=newE^.nr;
end;
if otpech=0 then//изменение
установок для печати
otpech:=otpech+n;
textcolor(white);
writeln('|------|---------------|----------|---------|-----------|--------|-------|');
writeln('Push the -enter- to the ExiT');
//для выхода ентер
end;
{-------------------------------------------------------------------------}
procedure obrabotka;
var
pop:ukaz;
x:integer;
//промежуточная величина
begin
pop:=verh;
//указатель на начало
x:=0;
while pop<>nil do//пока не конец списка
begin
pop^.inf.neopravdan:= pop^.inf.propusk- pop^.inf.opravdan; //подсчёт неоправданных пропусков
if pop^.inf.propusk=0 then pop^.inf.procent:=0//если пропуски=0 то и процент =0
else
pop^.inf.procent:=( pop^.inf.neopravdan/
pop^.inf.propusk)*100; //подсчёт процента
x:=x+pop^.inf.neopravdan; //нахождение промежуточной величины
pop^.inf.summa:=x;
pop:=pop^.nr;
end;
gotoxy(25,25);
writeln('Processing data is over push
the -enter-'); //завершилась обработка
readln;
end;
{------------------------------------------------------------------------}
{------------------prosmotr----------------------------------------------}
{------------------------------------------------------------------------}
//смотреть prosmotr_2 – всё аналогично ,только
добавляются нолвые поля.
procedure prosmotr(x:ukaz);
var
n:integer;
c:char;
begin
clrscr;
n:=0;
newE:=x;
writeln('|------|---------------|----------|---------|');
writeln('|#grupp| Name | amount of|
validly |');
writeln('| | | absence | |');
writeln('|------|---------------|----------|---------|');
while (newE<>right^.nr) and
(n<=6) do
begin
inc(n);
write('|', newE^.inf.nomergrupp:5,' ');
write('|',newE^.inf.fio:15);
write('|',newE^.inf.propusk:5,' ');
writeln('|', newE^.inf.opravdan:5,' |');
write('| | | | |');
writeln;
newE:=newE^.nr;
end;
if otpech=0 then
otpech:=otpech+n;
writeln('|------|---------------|----------|---------|');
writeln('Push the -enter- to the Exit');
end;
procedure klavishi(nom:integer);
var
c:char;
left:ukaz;
begin
otpech:=0; //обнуляем
left:=verh;
//указатель на начало
case nom of//выбор
1:prosmotr(left);
2:prosmotr_2(left);
3:begin
clrscr;gotoxy(20,25);textcolor(white);Writeln('Input the name of a student
which cold been finded');
textcolor(white);gotoxy(25,27);readln(z.fio);for
i:=1 to (15-length(z.fio)) do
z.fio:=z.fio+'
';left:=verh;poisk(left,z.fio); end; //установки перед процедурой
поиска
end;
while true do//бесконечный
цикл
begin
c:=readkey; //чтение клавиши
if ord(c)=13 then//если ентер-выход
case nom of
1:exit;
2:exit;
3:exit;
end
else// иначе
if c=#0 then
begin
c:=readkey;
if c=#80 then//если вниз
begin
if left=right then case nom of//если
конец списка
1:prosmotr(left); //выбор
2:prosmotr_2(left);
3:poisk(left,z.fio);
end
else
begin
if (kolvo-otpech=0) then//если
всё отпечатали
case nom of
1:prosmotr(left); //выбор
2:prosmotr_2(left);
3:poisk(left,z.fio);
end
else
begin
otpech:=otpech+1;
//увеличение числа отпечатанных на 1
left:=left^.nr; //перевод указателя
case nom of//выбор
1:prosmotr(left);
2:prosmotr_2(left);
3:poisk(left,z.fio);
end
end;
end;
end;
if c=#72 then//если вверх
begin
if left^.nl=nil//если список из 1-го эл-та
then case nom of//выбор
1:prosmotr(left);
2:prosmotr_2(left);
3:poisk(left,z.fio);
end
else//иначе
begin
otpech:=otpech-1;
//уменьшение числа отпечатанных на1
left:=left^.nl; //перевод указателя
case nom of//выбор
1:prosmotr(left);
2:prosmotr_2(left);
3:poisk(left,z.fio);
end
end;
end
else//иначе не вверз не вниз не
ентер
case nom of//выбор
1:prosmotr(left);
2:prosmotr_2(left);
3:poisk(left,z.fio);
end
end
end;
end;
{-------------------------------------------------------------------------}
{---------------------------ZAPIS V
FAIL----------------------------------}
{--------------------------------------------------------------------------}
procedure zapis_v_fail;
var
t:text;
pop:ukaz;
d:string;
begin
gotoxy(25,25);
writeln('Input the name of output
file'); //ввод имени файла
gotoxy(25,26);
readln(d);
assign(t,'d'); //установка
связи сним
rewrite(t);
//открытие в режиме записи
newE:=verh;
//указатель на начало
//запись в файл шапки
writeln(t,'|-------|---------------|----------|---------|----------|--------|-------|');
writeln(t,'|#grupp | Name |
amount of| validly | unvalidly| summa |percent|');
writeln(t,'| | | | absence | | | |');
writeln(t,'|-------|---------------|----------|---------|----------|--------|-------|');
while (newE<>nil) do//пока не конец сиска
begin//запись таблицы
write(t,'|',
newE^.inf.nomergrupp:5,' ');
write(t,'|',newE^.inf.fio:15);
write(t,'|',newE^.inf.propusk:5,' ');
write(t,'|', newE^.inf.opravdan:5,' |');
write(t,newE^.inf.neopravdan:7,' |');
write(t,newE^.inf.summa:6,' |');
writeln(t,newE^.inf.procent:5:2,' |');
writeln;
newE:=newE^.nr; //перевод указателя
Страницы: 1, 2, 3, 4, 5, 6 |