Показать сообщение отдельно
Старый 04.06.2010, 14:53   #1 (permalink)
darkdragon
Member
 
Регистрация: 08.04.2010
Сообщений: 38
Сказал(а) спасибо: 0
Поблагодарили 0 раз(а) в 0 сообщениях
Репутация: 10
По умолчанию Помогите доделать программу!

в процедуре redact там где именно редактированние мне надо если такой фамилии нет то выводило "нет такой фамилии" и по нажатию интер возврат в под меню! я пытался сделать но тогда меня весь файл не читается!
И очень надо помоць сделать диаграмму отражающую процент качества в группах!

Program group;
uses crt;
label 1;
type d=record
group:string[20];
kst,kolvo,oc2,oc3,oc4,oc5:integer;
srball:real;
end;
var mas:array[1..100] of d;
f:file of d;
dan,x:d;
grup:string;
kol,y,i,n,p,m,k,t,pos,r:integer;
kod:char;
procedure sortirovka;
label 1;
var i,j:integer;
begin
1:window(27,3,80,25);
textcolor(15);
clrscr;
assign(f,'d:spisok.dat');
for i:=1 to 25 do begin
gotoxy(1+i,2);
write(#196);
end;
gotoxy(1+i,2);
write(#191);
p:=i;
for i:=1 to 11 do begin
gotoxy(p+1,i+2);
write(#179);
end;
gotoxy(p+1,i+2);
write(#217);
y:=i;
for i:=25 downto 2 do begin
gotoxy(n+i,y+2);
write(#196);
end;
p:=n+i;
gotoxy(2,2);
write(#218);
for i:=1 to 11 do begin
gotoxy(2,2+i);
write(#179);
end;
for i:=1 to 25 do begin
gotoxy(1+i,4);
write(#196);
end;
gotoxy(p,y+2);
write(#192);
gotoxy(2,4);
write(#195);
gotoxy(26,4);
write(#180);
gotoxy(9,3);
textcolor(3);
write('Sortirovka');
textcolor(15);
kod:=' ';
t:=0;
y:=5;
while kod<>#13 do begin
gotoxy(4,5); if t=0 then textcolor(2) else textcolor(15); write('po gruppe');
gotoxy(4,6); if t=1 then textcolor(2) else textcolor(15); write('po srednemu ballu');
gotoxy(4,7); if t=2 then textcolor(2) else textcolor(15); write('po kol-vy 5');
gotoxy(4,8); if t=3 then textcolor(2) else textcolor(15); write('po kol-vu studentov');
gotoxy(4,9); if t=4 then textcolor(2) else textcolor(15); write('Nazad');
gotoxy(1,i+5);
kod:=readkey;
if kod=#0 then begin
gotoxy(1,y+2+t);
textcolor(4);
kod:=readkey;
if kod=#72 then
if t=0 then t:=4 else t:=t-1;
if kod=#80 then
if t=4 then t:=0 else t:=t+1;
textcolor(4);
gotoxy(1,y+1+t);
end;
end;
i:=1;
reset(f);
while not eof(f) do begin
read(f,dan);
kol:=dan.kolvo;
mas[i]:=dan;
i:=i+1;
end;
if t=0 then begin
reset(f);
if eof(f) then begin window(3,16,80,25); close(f);
textcolor(2);
writeln('fail ne sozdan');
readln;
clrscr;
goto 1;
end else begin
for i:=1 to kol do
for j:=i+1 to kol do begin
if mas[i].group>mas[j].group then
begin
x:=mas[i];
mas[i]:=mas[j];
mas[j]:=x;
end;
end;
close(f);
window(3,16,80,25);
textcolor(2);
gotoxy(1,1);
write('gruppa');
gotoxy (15,1);
write('kol-vo stud-v');
gotoxy (35,1);
write('2-k');
gotoxy(40,1);
write('3-k');
gotoxy(45,1);
write('4-k');
gotoxy(50,1);
write('5-k');
gotoxy(55,1);
writeln('srednii ball');
textcolor(15);
for i:=1 to kol do begin
gotoxy(1,1+i);
write(mas[i].group);
gotoxy(21,1+i);
write(mas[i].kst);
gotoxy(36,1+i);
write(mas[i].oc2);
gotoxy(41,1+i);
write(mas[i].oc3);
gotoxy(46,1+i);
write(mas[i].oc4);
gotoxy(51,1+i);
write(mas[i].oc5);
gotoxy(60,1+i);
writeln(mas[i].srball:1:1);
end;
readln;
clrscr;
goto 1;
end;
end else
if t=1 then begin
reset(f);
if eof(f) then begin window(3,16,80,25); close(f);
textcolor(2);
writeln('fail ne sozdan');
readln;
clrscr;
goto 1;
end else begin
for i:=1 to kol do
for j:=i+1 to kol do begin
if mas[i].srball>mas[j].srball then
begin
x:=mas[i];
mas[i]:=mas[j];
mas[j]:=x;
end;
end;
end;
close(f);
window(3,16,80,25);
textcolor(2);
gotoxy(1,1);
write('gruppa');
gotoxy (15,1);
write('kol-vo stud-v');
gotoxy (35,1);
write('2-k');
gotoxy(40,1);
write('3-k');
gotoxy(45,1);
write('4-k');
gotoxy(50,1);
write('5-k');
gotoxy(55,1);
writeln('srednii ball');
textcolor(15);
for i:=1 to kol do begin
gotoxy(1,1+i);
write(mas[i].group);
gotoxy(21,1+i);
write(mas[i].kst);
gotoxy(36,1+i);
write(mas[i].oc2);
gotoxy(41,1+i);
write(mas[i].oc3);
gotoxy(46,1+i);
write(mas[i].oc4);
gotoxy(51,1+i);
write(mas[i].oc5);
gotoxy(60,1+i);
writeln(mas[i].srball:1:1);
end;
readln;
clrscr;
goto 1;
end else
if t=2 then begin
reset(f);
if eof(f) then begin window(3,16,80,25); close(f);
textcolor(2);
writeln('fail ne sozdan');
textcolor(15);
readln;
clrscr;
goto 1;
end else begin
for i:=1 to kol do
for j:=i+1 to kol do begin
if mas[i].oc5>mas[j].oc5 then
begin
x:=mas[i];
mas[i]:=mas[j];
mas[j]:=x;
end;
end;
close(f);
window(3,16,80,25);
textcolor(2);
gotoxy(1,1);
write('gruppa');
gotoxy (15,1);
write('kol-vo stud-v');
gotoxy (35,1);
write('2-k');
gotoxy(40,1);
write('3-k');
gotoxy(45,1);
write('4-k');
gotoxy(50,1);
write('5-k');
gotoxy(55,1);
writeln('srednii ball');
textcolor(15);
for i:=1 to kol do begin
gotoxy(1,1+i);
write(mas[i].group);
gotoxy(21,1+i);
write(mas[i].kst);
gotoxy(36,1+i);
write(mas[i].oc2);
gotoxy(41,1+i);
write(mas[i].oc3);
gotoxy(46,1+i);
write(mas[i].oc4);
gotoxy(51,1+i);
write(mas[i].oc5);
gotoxy(60,1+i);
writeln(mas[i].srball:1:1);
end;
readln;
clrscr;
goto 1;
end;
end;
if t=3 then begin
reset(F);
if eof(f) then begin window(3,16,80,25); close(f);
textcolor(2);
writeln('fail ne sozdan');
readln;
clrscr;
textcolor(15);
goto 1;
end else begin
for i:=1 to kol do
for j:=i+1 to kol do begin
if mas[i].kst>mas[j].kst then
begin
x:=mas[i];
mas[i]:=mas[j];
mas[j]:=x;
end;
end;
close(f);
window(3,16,80,25);
textcolor(2);
gotoxy(1,1);
write('gruppa');
gotoxy (15,1);
write('kol-vo stud-v');
gotoxy (35,1);
write('2-k');
gotoxy(40,1);
write('3-k');
gotoxy(45,1);
write('4-k');
gotoxy(50,1);
write('5-k');
gotoxy(55,1);
writeln('srednii ball');
textcolor(15);
for i:=1 to kol do begin
gotoxy(1,1+i);
write(mas[i].group);
gotoxy(21,1+i);
write(mas[i].kst);
gotoxy(36,1+i);
write(mas[i].oc2);
gotoxy(41,1+i);
write(mas[i].oc3);
gotoxy(46,1+i);
write(mas[i].oc4);
gotoxy(51,1+i);
write(mas[i].oc5);
gotoxy(60,1+i);
writeln(mas[i].srball:1:1);
end;
readln;
clrscr;
goto 1;
end;
end;
if t=4 then textcolor(15) end;
procedure sozd;
begin
window(30,3,80,25);
clrscr;
assign(f,'d:spisok.dat');
rewrite(f);
write('Vvedite kol-vo grupp: ');
readln(dan.kolvo);
for i:=1 to dan.kolvo do begin
clrscr;
write('Vvedite ',i,'gruppu: ');
with dan do begin
readln(group);
repeat
writeln('vvedite kolvo studentov v gruppe');
readln(kst);
writeln('vvedite kolvo ocenok');
write('2- ');
readln(oc2);
write('3- ');
readln(oc3);
write('4- ');
readln(oc4);
write('5- ');
readln(oc5);
until kst=(oc2+oc3+oc4+oc5);
srball:=(oc2*2+oc3*3+oc4*4+oc5*5)/(kst);
write(f,dan);
end;
end;
end;
procedure chten;
begin
window(0,0,80,25);
window(30,1,80,25);
gotoxy(1,3);
assign(f,'d:spisok.dat');
reset(f);
if eof(f) then begin close(f);textcolor(2);
writeln('fail ne sozdan');
textcolor(15);
end else begin
gotoxy(1,3);
textcolor(10);
write('gruppa');
gotoxy (10,3);
write('kol-vo stud-v');
gotoxy (26,3);
write('2-k');
gotoxy(30,3);
write('3-k');
gotoxy(34,3);
write('4-k');
gotoxy(38,3);
write('5-k');
gotoxy(44,3);
writeln('sr.ball');
i:=1;
textcolor(15);
while not(eof(f)) do begin
read(f,dan);
gotoxy(1,3+i);
write(dan.group);
gotoxy(16,3+i);
write(dan.kst);
gotoxy(27,3+i);
write(dan.oc2);
gotoxy(31,3+i);
write(dan.oc3);
gotoxy(35,3+i);
write(dan.oc4);
gotoxy(39,3+i);
write(dan.oc5);
gotoxy(45,3+i);
writeln(dan.srball:1:1);
i:=i+1;
end;
close(f);
end;
readln;
clrscr;
window(1,1,27,13);
end;
darkdragon вне форума   Ответить с цитированием
Ads

Яндекс

Member
 
Регистрация: 31.10.2006
Сообщений: 40200
Записей в дневнике: 0
Сказал(а) спасибо: 0
Поблагодарили 0 раз(а) в 0 сообщениях
Репутация: 55070