Разработка базы данных, отражающей учет успеваемости студентов — страница 9

  • Просмотров 5584
  • Скачиваний 327
  • Размер файла 84
    Кб

tem1:=tem1^.sled; end; end; 5:begin {Вывод всех студентов с избранной оценкой} writeln('Введите оценку'); readln(str1); tem1:=tt4; tem2:=tt1; textcolor(red); while tem1<>nil do begin if tem1^.tabl.t2=str1 then begin str2:=tem1^.tabl.t4; while tem2<>nil do begin if tem2^.tabl.t1=str2 then begin with tem2^.tabl do writeln('Студент-',t3,' ',t4,' ',t2); nay:=true; end; tem2:=tem2^.sled; end; end; tem2:=tt1; tem1:=tem1^.sled; end; end; 6:begin {Найти дату сдачи предмета} writeln('Введите название предмета'); readln(str1); tem1:=tt2; while tem1<>nil do begin if tem1^.tabl.t2=str1 then begin str1:=tem1^.tabl.t1; break; end; tem1:=tem1^.sled; end; tem1:=tt4; while

tem1<>nil do begin if tem1^.tabl.t5=str1 then begin textcolor(red); writeln('Дата сдачи-',tem1^.tabl.t3); nay:=true; end; tem1:=tem1^.sled; end; end; end; textcolor(red); if not nay then writeln('Запрос невыполним'); textcolor(3); readln; nast:=menu1; menus(nast,nast.m); tek:=2; end; procedure writetip(temr:cc); begin clrscr; write('Введите имя файла'); writeln('в котором хотите сохранить данные'); readln(names); for i:=1 to 4 do begin if temr<>nil then begin temr:=nil; end; case i of 1:begin temr:=tt1; namer:='1'+names; end; 2:begin temr:=tt2; namer:='2'+names; end; 3:begin temr:=tt3; namer:='3'+names; end; 4:begin temr:=tt4; namer:='4'+names; end; end; assign(outf,namer); rewrite(outf); while

temr<>nil do begin write(outf, temr^.tabl); temr:=temr^.sled; end; CLOSE(outf); end; nast:=menu1; menus(nast,nast.m); tek:=2; end; procedure readtip(temr:cc); var tems:cc; begin clrscr; write('Введите имя файла'); writeln('из которого надо взять данные'); readln(names); for i:=1 to 4 do begin if temr<>nil then begin temr:=nil; end; if tems<>nil then begin tems:=nil; end; case i of 1:begin new(tt1); temr:=tt1; namer:='1'+names; end; 2:begin new(tt2); temr:=tt2; namer:='2'+names; end; 3:begin new(tt3); temr:=tt3; namer:='3'+names; end; 4:begin new(tt4); temr:=tt4; namer:='4'+names; end; end; assign(outf,namer); reset(outf); if eof(outf) then begin case i of 1:begin dispose(tt1);tt1:=nil;end; 2:begin

dispose(tt2);tt2:=nil;end; 3:begin dispose(tt3);tt3:=nil;end; 4:begin dispose(tt4);tt4:=nil;end; end; end else begin tems:=temr; while temr<>nil do begin if eof(outf) then break; read(outf,temr^.tabl); if eof(outf) then break; new(temr^.sled); temr:=temr^.sled; end; temr^.sled:=nil; case i of 1:tt1:=tems; 2:tt2:=tems; 3:tt3:=tems; 4:tt4:=tems; end; end; CLOSE(outf); end; nast:=menu1; menus(nast,nast.m); tek:=2; end; procedure main; begin key:=#0; if nast.st[1]=menu1.st[1] then begin {Если меню - основное} case tek of 2:readtip(temr); 3:writetip(temr); 4,5,7:begin nast:=menu2; menus(nast,nast.m); if tek=7 then issor:=true; if tek=4 then vfile:=true else if tek=5 then vfile:=false; tek:=2; end; 6:begin nast:=menu3; menus(nast,nast.m); tek:=2; end; 8:begin

nast:=menu4; menus(nast,nast.m); tek:=2; end; 9: begin exist:=true; end; end; end else if nast.st[1]=menu3.st[1] then begin {Если текущее меню-menu3} case tek of 2,3,4:begin izm:=tek-1; nast:=menu2; menus(nast,nast.m); tek:=2; end; 5:begin nast:=menu1; menus(nast,nast.m); tek:=2; end; end; end else if nast.st[1]=menu4.st[1] then begin {Если текущее меню-menu4} case tek of 2,3,4,5,6:zapros(tek); 7:begin nast:=menu1; menus(nast,nast.m); tek:=2; end; end; end else if nast.st[1]=menu2.st[1] then begin {Если текущее меню-menu2} if izm>0 then begin case tek of 2:obrabotka(izm, tek-1,tt1); 3:obrabotka(izm, tek-1,tt2); 4:obrabotka(izm, tek-1,tt3); 5:obrabotka(izm, tek-1,tt4); 6:begin nast:=menu1; menus(nast,nast.m); izm:=0; tek:=2; end;

end; end else if issor=true then begin issor:=false; case tek of 2:sort(izm, tek-1,tt1); 3:sort(izm, tek-1,tt2); 4:sort(izm, tek-1,tt3); 5:sort(izm, tek-1,tt4); 6:begin nast:=menu1; menus(nast,nast.m); izm:=0; tek:=2; end; end; end else begin case tek of 2:if vfile then tabl11(tek,tt1) else tabl1(tek,tt1,false); 3:if vfile then tabl11(tek,tt2) else tabl1(tek,tt2,false); 4:if vfile then tabl11(tek,tt3) else tabl1(tek,tt3,false); 5:if vfile then tabl11(tek,tt4) else tabl1(tek,tt4,false); 6:begin nast:=menu1; menus(nast,nast.m); izm:=0; tek:=2; end; end; end; end; end; begin clrscr; textBackground(black); tek:=2; kr:='-'; exist:=false; nast:=menu1; menus(nast,nast.m); while 1>0 do begin if keypressed then key:=readkey; case key of #80:ramka('+'); #72:ramka('-'); #27:exist:=true;