I have this assignment where I have to write a program that balances your checkbook. It is supposed to input a letter followed by a real number, where the letter is a transaction code and the number is the amount of the transaction. Anyway, all I have right now is the code to enter the char and the real and quit if the char is 'e'. It works fine the first time, but then the second time around it gives me a runtime error 106 right after I enter the char. As I understand it, 106 means you are trying to put a non-number into a number, but thats not what I'm doing. I'm stumped, any help?
And the output:
Code:
Program checking;
var balance, amount, test : real;
done : boolean;
trans : char;
procedure getTransaction;
begin
writeln('Enter a transaction:');
read(trans, amount);
if trans = 'e' then
done := true;
end;
begin
done := false;
writeln('Enter the beginning balance:');
readln(balance);
while not done do begin
getTransaction;
writeln(trans, amount:10:2);
end;
end.
Code:
F:\Pascal>checking
Enter the beginning balance:
455
Enter a transaction:
c 400
c 400.00
Enter a transaction:
d 500
Runtime error 106 at 0x0040107E
0x0040107E
0x0040110B
0x00401199