PROGRAM p2(Input,Output,Infile,Outfile); { Mel Simmons Program 2 } CONST MAXSCORE = 200; PAGESIZE = 5; VAR Test1, Test2, Final:Integer; Percent:Real; Outfile, Infile:Text; LineCt:Integer; FirstTime:Boolean; BEGIN {P2} Assign(Infile, 'c:\scores.txt'); Reset(Infile); Assign(Outfile, 'c:\report.txt'); Rewrite(Outfile); LineCt := PAGESIZE + 1; FirstTime := True; While Not EOF(Infile) Do Begin IF LineCt >= PAGESIZE Then Begin IF FirstTime Then FirstTime := False Else Write(Outfile, chr(12)); Writeln(Outfile, 'Test Test'); Writeln(Outfile, ' 1 2 Final Percent'); Writeln(Outfile); LineCt := 3; End; Readln(Infile, Test1, Test2, Final); Percent := (Test1 + Test2 + Final) * 100 / MAXSCORE; Write(Outfile, Test1:3, Test2:10, Final:10, Percent:10:1); IF Percent >= 60 THEN Writeln(Outfile, 'Pass':10) ELSE Writeln(Outfile, 'Fail':10); LineCt := LineCt + 1; End; Close(Outfile); Readln; END. {P2}