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
Re: Invalid Variable Reference? Posted by zibadian on 11 Oct 2003 at 10:45 PM
: First...I don't know what the error means but...could someone please offer me a hand as to why the error is there and how I can get rid of it to finish this program. Remember, this is just a fragment so far...
:
: PROGRAM Charges;
: USES CRT;
:
: VAR
:
: UserAccount : String[5];
: PriorityCode, NumberCustomer : Integer;
: UseHours, HourCharge, AveCharge, PriorityCharge, TotalCharge : Real;
:
: Procedure Headings;
:
: Begin
:
: Writeln(' Apex Computer Service');
: Writeln;
: Writeln(' Account Charge');
: Writeln(' --------- --------');
:
: End;
:
: Procedure GetInfo;
:
: Begin
:
: Writeln(' Please Input Your User Account Number: ');
: Readln(UserAccount);
: Writeln(' Please Input Your Priority Code: ');
: Readln(PriorityCode);
: Writeln(' Please Input Your Hours of Usage: ');
: Readln(UseHours);
:
: End;
:
: Procedure LoopingIt;
:
: Begin
:
: WHILE UserAccount <> 'xxxxx' DO
:
: Begin
:
: IF (UseHours > 15.00) THEN
: HourCharge := (225.00 + (15.00 * UseHours))
:
: ELSE (UseHours > 5.00) AND (UseHours <= 15.00)
: HourCharge := (100.00 + (25.00 * UseHours))
:
: ELSE
: HourCharge := 100.00;
:
: End;
: End;
: End;
:
: BEGIN
:
: CLRSCR;
: Headings;
: GetInfo;
: LoopingIt;
: CalcCharge;
:
: END.
:
:
The "Invalid Variable Reference" means that the compiler cannot a certain statement, unless the variables it uses are of identical formats.
Given the fact that you want us to guess where the error occurred, my guess is that it occurred in the while-do. You could try to solve it by changing the type of the UserAccount into a normal string.
Also you have created an infinite loop, because the user cannot change the UserAccount from within the while-do.
Thread Tree
FyreAndIce83 Invalid Variable Reference? on 11 Oct 2003 at 5:47 PM
zibadian Re: Invalid Variable Reference? on 11 Oct 2003 at 10:45 PM
Perran Re: Invalid Variable Reference? on 12 Oct 2003 at 4:14 AM
FyreAndIce83 Re: Invalid Variable Reference? on 13 Oct 2003 at 4:16 AM
zibadian Re: Invalid Variable Reference? on 13 Oct 2003 at 11:05 AM
FyreAndIce83 Re: Invalid Variable Reference? on 14 Oct 2003 at 9:30 AM
zibadian Re: Invalid Variable Reference? on 14 Oct 2003 at 12:37 PM
FyreAndIce83 Re: Invalid Variable Reference? on 14 Oct 2003 at 3:56 PM
zibadian Re: Invalid Variable Reference? on 14 Oct 2003 at 9:14 PM
FyreAndIce83 Re: Invalid Variable Reference? on 15 Oct 2003 at 3:08 AM
zibadian Re: Invalid Variable Reference? on 15 Oct 2003 at 3:43 AM
FyreAndIce83 Re: Invalid Variable Reference? on 15 Oct 2003 at 5:42 AM
delljohnb Re: Invalid Variable Reference? on 13 Oct 2003 at 6:39 AM
FyreAndIce83 Re: Invalid Variable Reference? on 13 Oct 2003 at 7:17 AM
Manning Re: Invalid Variable Reference? on 13 Oct 2003 at 8:09 AM



 

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.