Dear Sir,
I have got confused to the real / integer. Would you mind helping to express it to me?
I have got the answer of the following question:
Write a menu system for the currency exchange program. My menu could look like this:
Exchange rates
How much money would you like to exchange?
Press 1 for Australian dollars
2 for US dollars
3 for English pounds
4 for Japanese yen
5 for Euros
6 for Indian rupees
7 for PNG kina
8 for SA rand
My answer:
program Conversion_with_menuII;
{$APPTYPE CONSOLE}
uses
SysUtils;
const
aus=0.9024;
us=0.7697;
eng=0.3803;
y=0.9144;
e=0.5657;
rup=31.17;
kina=1.6197;
rand=5.1805;
var
nz_dollar: real;
aus_out: real;
us_out: real;
eng_out: real;
y_out: real;
e_out: real;
rup_out: real;
kina_out: real;
rand_out: real;
choice: integer;
begin
write('How much money would you lie to change? :$');
readln(nz_dollar);
writeln('Please select which currency you would like to convert to');
writeln('Press 1 for Australian dollars');
writeln('Press 2 for US dollars');
writeln('Press 3 for English pounds');
writeln('Press 4 for Japanese yen');
writeln('Press 5 for Euros');
writeln('Press 6 for Indian rupees');
writeln('Press 7 for PNG kina');
writeln('Press 8 for SA rand');
readln(choice);
case choice of
1: begin
aus_out:=nz_dollar*aus;
writeln('The amount in Australian Dollars is: $',aus_out:6:2);
end;
2: begin
us_out:=nz_dollar*us;
writeln('The amount in US dollars is: $',us_out:6:2);
end;
3: begin
eng_out:=nz_dollar*eng;
writeln('The amount in English pounds is: $',eng_out:6:2);
end;
4: begin
y_out:=nz_dollar*y;
writeln('The amount in Japanese yen is: $',y_out:6:2);
end;
5: begin
e_out:=nz_dollar*e;
writeln('The amount in Euros is: $',e_out:6:2);
end;
6: begin
rup_out:=nz_dollar*rup;
writeln('The amount in Indian rupees is $',rup_out:6:2);
end;
7: begin
kina_out:=nz_dollar*kina;
writeln('The amount in PNG kina is $',kina_out:6:2);
end;
8: begin
rand_out:=nz_dollar*rand;
writeln('The amount in SA rand is $',rand_out:6:2);
end;
end;
readln;
end.
I have tried to change the real to integer but it is work. Could you express the reason to me please?
Cheers,