I am working on an assignment for my programming class and I keep coming up with this problem.
ERROR 20: Variable Identifier expected.
Here is my code:
Program FinalProgram;
Uses Crt;
var
IDArray: Array[1..8] of string[11];
ScoreArray: Array[1..8] of integer;
GradeArray: Array[1..8] of char;
Data: text;
Score: integer;
ID: string[11];
procedure InputSub(var X: integer; ScoreArray, Score: integer;
IDArray, ID: string);
begin
clrscr;
Assign (Data,'C:\scores.txt');
Reset (Data);
X := 1;
While not EOF(Data) Do
begin
readln(Data, IDArray[X], ScoreArray)
end;
Close (Data);
end;
function ExamGrade(Score: integer):char;
begin
If Score >= 90 Then
ExamGrade := 'A';
If Score >=80 Then
ExamGrade := 'B';
If Score >= 70 Then
ExamGrade := 'C';
If Score >= 60 Then
ExamGrade := 'D';
If Score <= 59 Then
ExamGrade := 'F';
end;
procedure PrintSub(var X: integer; GradeArray: char;
ScoreArray:integer; IDArray: string);
begin
Writeln('ID':10,'Score':10,'Grade':10);
Writeln(IDArray:10, ScoreArray:10, GradeArray:10);
Readln;
End;
begin{main}
InputSub(var X: integer; ScoreArray, Score: integer; IDArray, ID:
string);
For X := 1 to 8 Do
begin
ExamGrade(ScoreArray[X]);
GradeArray[X] := ExamGrade(ScoreArray[2]);
end;
PrintSub(var X: integer; GradeArray: char; ScoreArray:integer;
IDArray: string);
end.
The problem happens on the main program, when it reaches the start of the InputSub. Could someone help me, please? It would be much appreciated!