Program PRG3;
Var { Declaring Varaibles }
  FileIn:text;              
  FileOut:text;                  
  SECTION_NUMBER:string[5];      
  STUDENT_ID:string[9];          
  LAST_NAME:string[20];          
  FIRST_NAME:string[10];         
  RAW_SCORE:real;
  STUDENT_COUNT:integer;         
  AVERAGE_SCORE:integer;         
  AVERAGE_GRADE:integer;
  Percent:real;
  more_rec:boolean; {end of file flag}
  Computed_grade:integer;
  Grade:real;


procedure read_record;
  begin
   if not Eof(fileIn) then
    readln(SECTION_NUMBER,STUDENT_ID,LAST_NAME,FIRST_NAME,RAW_SCORE)
else
  more_rec := False
end;  {read record}   

procedure print_header;
begin
    writeln(fileout,Space(14),'COMPUTE GRADE');
    writeln(fileout,space(17),'SECTION','SECTION_NUMBER');
    writeln(fileout);
    writeln(fileout,space(9),'LAST_NAME',space(11),'FIRST_NAME','    RAW_SCORE','   COMPUTED_GRADE');
    writeln(fileout,'   ID',Space(17),'LAST NAME',Space(11),'FIRST NAME  PRCNT');
    writeln(fileout);
    Writeln(FileOut,'STUDENT COUNT',STUDENT_COUNT);
    Writeln(FileOut,'AVERAGE SCORE',AVERAGE_SCORE);
    Writeln(FileOut,'AVERAGE GRADE',AVERAGE_GRADE);
end; {print_header}

procedure initial;
begin
    assign(filein,'prg3-150.DAT');
    reset(filein);
    assign(fileout,'prg3-150fileout.dat');
    rewrite(fileout);
    read_record;
end; {initial}
procedure compute_grade;
begin
IF percent >= 90.0 Then 
     Grade:= 4.0
  else
  IF percent >= 85.0 then 
     Grade := 3.5 
  else 
  IF percent >= 80.0 Then
     grade :=3.0 
  else
  IF percent >= 75.0 Then
     grade:= 2.5  
  else
  IF percent >= 70.0 Then
     grade := 2.0 
  else 
  IF percent >= 65.0 Then 
     grade := 1.5 
  else 
  IF percent >= 60.0 Then 
     grade := 1.0 
  else 
  IF percent >= 0.0 Then 
     grade := 0.0 
  else 
end;
procedure process;
begin
    PERCENT := (RAW_SCORE / 850.0) * 100.0;
    writeln(FileOut,'last_name,'  ',first_name,'   ',raw_score:3:0,'    ',computed_grade:3:1);
    read_record;
end; {process}
procedure wrapup;
begin
    writeln(fileOut);
    writeln(fileout,'student_count');
    close(filein);
    close(fileout);
end; {wrapup}
begin
    initial;
    while more_rec=true do
        process;
    wrapup;
end.

After compiling this program I keep getting the same error messages over and over again. Even after I edit/change whatever the compiler suggest I need to change. Is there something I'm missing?

Recommended Answers

All 3 Replies

I keep getting the same error messages over and over again

Show the error messages.

Line 73 has a redundant else which may be causing issues too.

It's giving me the following message:
(20,3) note: Local variable COMPUTED_GRADE not used
(22,3) note: Local Variable GRADE Not used
(32,11)Hint: Local Proc PRINT_HEADER is not used
(54,11)Hint: Local Proc Computed_GRADE is not used
Linking Computed.exe
99 lines compiled, 3.9 sec

I managed to get it to compile but after trying to run it I get an runtime error 2 at 0x00413FA

Run-time error 2 is a "File not found" error.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.