Prosim ak bude niekdo taky dobry a skusi tam najst chybu a pomoze nam nejak.. tu ide o zachranu zivota..
Kód: Vybrať všetko
PROGRAM projekt;
USES CRT,GRAPH;
CONST MIN = 29.9;
TYPE student = record
meno:String;
body:Integer;
per:Real;
end;
VAR i,max,poc,v,gd,gm,min_b,max_b,poz:Integer;
pole:array[1..100] of student;
priemer,suc:real;
BEGIN
ClrScr;
gd:=detect;
initgraph(gd,gm,'c:\progra\units');
Write('Zadajte poźet §iakov: ');
ReadLn(poc);
Write('Zadajte maxim lny poźet bodov: ');
ReadLn(max);
WriteLn('1');
While true Do
begin
WriteLn('M E N U');
WriteLn('--------');
WriteLn('1. Zaźaś zad vanie věsledkov');
WriteLn('2. Zobraziś tabu–ku');
WriteLn('3. Zobraziś çtatistick‚ věsledky');
WriteLn('INµ VO•BA: KONIEC PROGRAMU');
WriteLn('2');
Write('ZADAJTE VAćU VO•BU PROSÖM: ');
ReadLn(v);
CASE v OF
1:begin
For i:=1 to poc do
begin
Write('Zadajte priezvisko §iaka ź.',i,': ');
ReadLn(pole[i].meno);
Write('Zadajte poźet bodov §iaka: ');
ReadLn(pole[i].body);
While ((pole[i].body>max) or (pole[i].body<0)) do
begin
Write('Zadajte poźet bodov §iaka: ');
ReadLn(pole[i].body);
end;
pole[i].per:=((100*pole[i].body)/max);
end;
end;
2:begin
poz:=1;
Line(0,0,639,0);
gotoxy(0,0);
Write('MENO');
gotoxy(15,0);
Write('BODY');
gotoxy(30,0);
Write('PERCENTA');
gotoxy(45,0);
Write('HODNOTENIE');
Line(0,20,480,20);
Line(112,0,112,(poc*20));
Line(232,0,232,(poc*20));
Line(352,0,352,(poc*20));
Line(472,0,472,(poc*20));
For i:=1 to poc do
begin
gotoxy(0,poz);
Write(pole[i].meno);
gotoxy(15,poz);
Write(pole[i].body);
gotoxy(30,poz);
Write(pole[i].per);
If ((pole[i].per<=100) and (pole[i].per>=90)) then
begin
gotoxy(45,poz);
Write('VíBORNí');
end;
If ((pole[i].per<=89.9) and (pole[i].per>=75)) then
begin
gotoxy(45,poz);
Write('CHVµLITEBNí');
end;
If ((pole[i].per<=74.9) and (pole[i].per>=50)) then
begin
gotoxy(45,poz);
Write('DOBRí');
end;
If ((pole[i].per<=49.9) and (pole[i].per>=30)) then
begin
gotoXY(45,poz);
Write('DOSTATO¬Ní');
end;
If (pole[i].per<30) then
begin
gotoxy(45,poz);
Write('NEDOSTATO¬Ní');
end;
Line(0,(poz*20),472,(poz*20));
poz:=poz+1;
end;
end;
3:begin
min_b:=pole[1].body;
max_b:=pole[1].body;
suc:=0;
For i:=1 to poc do
begin
If (pole[i].body<min_b) Then min_b:=pole[i].body;
If (pole[i].body>max_b) Then max_b:=pole[i].body;
suc:=suc+pole[i].body;
end;
priemer:=suc/poc;
WriteLn('MINIMUM:');
For i:=1 to poc do
begin
If (pole[i].body=min_b) Then
WriteLn('MENO: ',pole[i].meno,' BODY: ',pole[i].body);
end;
WriteLn('MAXIMUM:');
For i:=1 to poc do
begin
If (pole[i].body=max_b) Then
WriteLn('MENO: ',pole[i].meno,' BODY: ',pole[i].body);
end;
WriteLn('NEUSPELI:');
For i:=1 to poc do
begin
If (pole[i].per<30) Then
WriteLn('MENO: ',pole[i].meno);
end;
end;
ELSE break;
end;
end;
ReadLn;
closegraph;
END.