04.06.2010, 14:53 | #1 (permalink) |
Member
Регистрация: 08.04.2010
Сообщений: 38
Сказал(а) спасибо: 0
Поблагодарили 0 раз(а) в 0 сообщениях
Репутация: 10
|
Помогите доделать программу!
И очень надо помоць сделать диаграмму отражающую процент качества в группах! 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; |
04.06.2010, 14:53 | |
Helpmaster
Member
Регистрация: 08.03.2016
Сообщений: 0
|
В интернете часто создаются схожие темы Помогите отладить программу Помогите довести до ума программу |
04.06.2010, 14:56 | #2 (permalink) |
Member
Регистрация: 08.04.2010
Сообщений: 38
Сказал(а) спасибо: 0
Поблагодарили 0 раз(а) в 0 сообщениях
Репутация: 10
|
procedure redact;
label 1; var j:integer; begin 1:window(27,3,80,25); 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); textcolor(3); gotoxy(5,3); write('Poisk i red-nie'); kod:=' '; i:=0; y:=5; while kod<>#13 do begin gotoxy(4,5); if i=0 then textcolor(2) else textcolor(15); write('po gruppe'); gotoxy(4,6); if i=1 then textcolor(2) else textcolor(15); write('po kol-vu'); gotoxy(4,7); if i=2 then textcolor(2) else textcolor(15); write('po kol-vy 5'); gotoxy(4,8); if i=3 then textcolor(2) else textcolor(15); write('redactirovat'); gotoxy(4,9); if i=4 then textcolor(2) else textcolor(15); write('Nazad'); gotoxy(3,i+5); kod:=readkey; if kod=#0 then begin gotoxy(1,y+2+i); textcolor(4); kod:=readkey; if kod=#72 then if i=0 then i:=4 else i:=i-1; if kod=#80 then if i=4 then i:=0 else i:=i+1; textcolor(4); gotoxy(1,y+1+i); end; end; if i=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; textcolor(15); goto 1; end else begin window(3,16,80,25); clrscr; writeln('vvedite gruppu'); readln(grup); clrscr; gotoxy(1,1); textcolor(2); 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'); reset(f); p:=1; textcolor(15); while not(eof(f)) do begin read(f,dan); if dan.group=grup then begin pos:=filepos(f); gotoxy(1,1+p); write(dan.group); gotoxy(21,1+p); write(dan.kst); gotoxy(36,1+p); write(dan.oc2); gotoxy(41,1+p); write(dan.oc3); gotoxy(46,1+p); write(dan.oc4); gotoxy(51,1+p); write(dan.oc5); gotoxy(60,1+p); writeln(dan.srball:1:1); p:=p+1; end; end; end; readln; close(f); clrscr; goto 1; end else if i=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; textcolor(15); goto 1; end else begin window(3,16,80,25); clrscr; writeln('vvedite kolvo studentov'); readln(j); clrscr; 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'); reset(f); p:=1; textcolor(15); while not(eof(f)) do begin read(f,dan); if dan.kst=j then begin pos:=filepos(f); gotoxy(1,1+p); write(dan.group); gotoxy(21,1+p); write(dan.kst); gotoxy(36,1+p); write(dan.oc2); gotoxy(41,1+p); write(dan.oc3); gotoxy(46,1+p); write(dan.oc4); gotoxy(51,1+p); write(dan.oc5); gotoxy(60,1+p); writeln(dan.srball:1:1); p:=p+1; end; end; end; close(f); readln; clrscr; goto 1; end else if i=2 then begin reset(f); if eof(f) then begin window(3,16,80,25); close(f); textcolor(2); writeln('fail ne sozdan'); readln; textcolor(15); goto 1; end else begin window(3,16,80,25); clrscr; writeln('vvedite kol-vo 5'); readln(j); clrscr; reset(f); 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'); p:=1; textcolor(15); while not(eof(f)) do begin read(f,dan); if dan.oc5=j then begin pos:=filepos(f); gotoxy(1,1+p); write(dan.group); gotoxy(21,1+p); write(dan.kst); gotoxy(36,1+p); write(dan.oc2); gotoxy(41,1+p); write(dan.oc3); gotoxy(46,1+p); write(dan.oc4); gotoxy(51,1+p); write(dan.oc5); gotoxy(60,1+p); writeln(dan.srball:1:1); p:=p+1; end; end; end; close(f); readln; clrscr; goto 1; end else if i=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 window(3,16,80,25); clrscr; reset(f); gotoxy(1,1); textcolor(2); 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'); reset(f); p:=1; textcolor(15); while not eof(f) do begin read(f,dan); gotoxy(1,1+p); write(dan.group); gotoxy(21,1+p); write(dan.kst); gotoxy(36,1+p); write(dan.oc2); gotoxy(41,1+p); write(dan.oc3); gotoxy(46,1+p); write(dan.oc4); gotoxy(51,1+p); write(dan.oc5); gotoxy(60,1+p); writeln(dan.srball:1:1); p:=p+1; end; close(f); textcolor(9); writeln('vvedite gruppu kotoruiu nujno otredactirovat'); textcolor(15); readln(grup); reset(f); 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'); reset(f); p:=1; textcolor(15); while not(eof(f)) do begin read(f,dan); if dan.group=grup then begin pos:=filepos(f); gotoxy(1,1+p); write(dan.group); gotoxy(21,1+p); write(dan.kst); gotoxy(36,1+p); write(dan.oc2); gotoxy(41,1+p); write(dan.oc3); gotoxy(46,1+p); write(dan.oc4); gotoxy(51,1+p); write(dan.oc5); gotoxy(60,1+p); writeln(dan.srball:1:1); p:=p+1; gotoxy(1,dan.kolvo+4); textcolor(9); writeln('redactirovat? 1-da,2-net'); textcolor(15); readln(r); if r=1 then begin writeln('vvedite nazvanie gruppi'); readln(dan.group); repeat writeln('vvedite kolvo studentov'); readln(dan.kst); writeln('vvedite kolvo ocenok'); write('2- '); readln(dan.oc2); write('3- '); readln(dan.oc3); write('4- '); readln(dan.oc4); write('5- '); readln(dan.oc5); until dan.kst=(dan.oc2+dan.oc3+dan.oc4+dan.oc5); dan.srball:=(dan.oc2*2+dan.oc3*3+dan.oc4*4+dan.oc5 *5)/(dan.kst); end else if r=2 then begin clrscr; goto 1; end; 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'); reset(f); p:=2; textcolor(9); seek(f,pos-1); clrscr; writeln('otredactirovanno'); write(f,dan); seek(f,pos-1); read(f,dan); textcolor(2); gotoxy(1,2); write('gruppa'); gotoxy (15,2); write('kol-vo stud-v'); gotoxy (35,2); write('2-k'); gotoxy(40,2); write('3-k'); gotoxy(45,2); write('4-k'); gotoxy(50,2); write('5-k'); gotoxy(55,2); writeln('srednii ball'); textcolor(15); gotoxy(1,1+p); write(dan.group); gotoxy(21,1+p); write(dan.kst); gotoxy(36,1+p); write(dan.oc2); gotoxy(41,1+p); write(dan.oc3); gotoxy(46,1+p); write(dan.oc4); gotoxy(51,1+p); write(dan.oc5); gotoxy(60,1+p); writeln(dan.srball:1:1); seek(f,0); p:=5; textcolor(9); writeln('otredaktirovannii spisok'); textcolor(2); gotoxy(1,5); write('gruppa'); gotoxy (15,5); write('kol-vo stud-v'); gotoxy (35,5); write('2-k'); gotoxy(40,5); write('3-k'); gotoxy(45,5); write('4-k'); gotoxy(50,5); write('5-k'); gotoxy(55,5); writeln('srednii ball'); textcolor(15); while not(eof(f)) do begin read(f,dan); gotoxy(1,1+p); write(dan.group); gotoxy(21,1+p); write(dan.kst); gotoxy(36,1+p); write(dan.oc2); gotoxy(41,1+p); write(dan.oc3); gotoxy(46,1+p); write(dan.oc4); gotoxy(51,1+p); write(dan.oc5); gotoxy(60,1+p); writeln(dan.srball:1:1); p:=p+1; end; close(f); readln; clrscr; goto 1; end else clrscr; end; end; end; if i=4 then textcolor(15); end; procedure dobavl; begin window(29,3,80,25); clrscr; assign(f,'d:spisok.dat'); reset(f); while not eof(f) do begin read(f,dan); pos:=filepos(f); end; write('Vvedite gruppu: '); with dan do begin readln(group); repeat writeln('vvedite kol-vo studentov'); readln(kst); writeln('vvedite kol-vo 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; kolvo:=kolvo+1; seek(f,pos); write(f,dan); end; close(f); end; |
04.06.2010, 14:56 | #3 (permalink) |
Member
Регистрация: 08.04.2010
Сообщений: 38
Сказал(а) спасибо: 0
Поблагодарили 0 раз(а) в 0 сообщениях
Репутация: 10
|
begin
1:clrscr; window(0,0,80,25); window(1,1,27,13); textcolor(15); 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(13,3); write('MENU'); kod:=' '; k:=0; y:=5; while kod<>#13 do begin gotoxy(4,5); if k=0 then textcolor(4) else textcolor(15); write('Sozdanie faila'); gotoxy(4,6); if k=1 then textcolor(4) else textcolor(15); write('Chtenie dannih'); gotoxy(4,7); if k=2 then textcolor(4) else textcolor(15); write('Dobavlenie zapisi'); gotoxy(4,8); if k=3 then textcolor(4) else textcolor(15); write('Sortirovka dannih'); gotoxy(4,9); if k=4 then textcolor(4) else textcolor(15); write('Redactirovanie zapisi'); gotoxy(4,10); if k=5 then textcolor(4) else textcolor(15); write('Diagramma'); gotoxy(4,11); if k=6 then textcolor(4) else textcolor(15); write('Vihod'); gotoxy(1,4); gotoxy(1,k+5); kod:=readkey; if kod=#0 then begin gotoxy(1,y+2+k); textcolor(4); kod:=readkey; if kod=#72 then if k=0 then k:=6 else k:=k-1; if kod=#80 then if k=6 then k:=0 else k:=k+1; textcolor(4); gotoxy(1,y+2+k); end; end; case k of 0:begin sozd; goto 1; end; 1:begin chten; goto 1; end; 2:begin dobavl; readln; goto 1; end; 3:begin sortirovka; goto 1 ; end; 4:begin redact; goto 1; end; 6:end; end. |
04.06.2010, 15:16 | #4 (permalink) |
一步一步地会到目的
Регистрация: 09.05.2009
Адрес: Черноземье
Сообщений: 10,939
Записей в дневнике: 10
Сказал(а) спасибо: 140
Поблагодарили 80 раз(а) в 33 сообщениях
Репутация: 28362
|
Кто ж этот код сидеть разбирать будет? Хоть бы написали, для чего программа,
выложили бы непосредственно проблемный код и описали бы значения переменных.. |
Ads | |
Member
Регистрация: 31.10.2006
Сообщений: 40200
Записей в дневнике: 0
Сказал(а) спасибо: 0
Поблагодарили 0 раз(а) в 0 сообщениях
Репутация: 55070
|
|
|