Procedure Exchangerates;
var
selection: integer;
answer, GBP, USD, EUR, JPY: string;
begin
Assignfile(ERfile, 'ER.dat');
reset(ERfile);
while not eof(erfile) do
begin
read(erfile, er);
writeln('Which currency do you want to convert from, euros, pounds, dollars or yen');
readln(answer);
if answer = 'GBP' then
begin
writeln('GBP');
writeln('How many pounds to you want to convert to dollars?');
readln(selection);
writeln(selection*er.usdtopound:0:2);
writeln('How many pounds do you want to convert to euros?');
readln(selection);
writeln(selection*er.eurotopound:0:2);
writeln('How many pounds do you want to convert to yen?');
readln(selection);
writeln(selection*er.yentopound:0:2) ; …
Run Code Online (Sandbox Code Playgroud)