Pascal

Moderators: None (Apply to moderate this forum)
Number of threads: 4106
Number of posts: 14016

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Help! I need some help with my programming! Posted by DemiHuman on 7 Dec 2004 at 9:17 PM
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!
Report
Re: Help! I need some help with my programming! Re Posted by bobject on 8 Dec 2004 at 3:19 AM
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



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.