I am new to pascal and i have been asked to make a program that willa llow the user to type the amount of miles they have driven.
then to take this number and multiply it by 0.20 (they get 20p per mile driven) then output the information to the user as:
you have driven xxx miles
your travelling allowance is £xx.xx
press any key to continue...
this is what i ahve done so far. please bear in mind i am a total beginner so comments in the code would be excellent so i understand it and so i can apply the knowledge to other programs.
program TASK1(INPUT,OUTPUT);
USES CRT;
var miles :integer;
pay :integer;
allowance :INTEGER;
begin
pay:=0.20;
WRITELN ('ENTER NUMBER OF MILES DRIVEN: ');
READ(miles); {take input from user}
WRITELN(' ');
WRITELN(miles , '*', pay , '= ', allowance );
WRITE('PRESS ANY KEY TO CONTINUE');
READKEY; {THIS WAITS FOR YOU TO PRESS A KEY}
end.
thank you in advance.
the compiler says there are 3 errors:
1. 17 / 50 assignment1.pas
Warning: Variable ALLOWANCE does not seem to be initialized
2. 10 / 6 assignment1.pas
Error: Incompatible types: got "S80REAL" expected "LONGINT"
3. 23 assignment1.pas
Fatal: There were 1 errors compiling module, stopping
from mr skulls