Help! I need some help with my programming! - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Help! I need some help with my programming!

DemiHumanDemiHuman Posts: 1Member
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!

Comments

  • bobjectbobject Posts: 16Member
    hi first you need to realize that are trying to declare variables when calling the procedure to run. this is not allowed what you need to do is put the variables in to the procedure. for example in sted of

    InputSub(var X: integer; ScoreArray, Score: integer; IDArray, ID:
    string);

    you need to do something like this

    InputSub(inx,ina,inia,ind);
    where inx,ina,inia,ind are variables withch you will have to put in the correct ones
Sign In or Register to comment.