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) ;
end;
else
if answer = 'EUR' then
writeln('hi');
end;
closefile(erfile);
end;
那是需要在貨幣之間進行轉換的程序表單程序,當我嘗試運行if語句時出現錯誤,出於何種原因以及如何解決它?錯誤是[Error] Currencyconvertor3.dpr(75):';'前 'ELSE' 不允許的,並且當我刪除分號我得到3個更多的錯誤Delphi 7 else if語句錯誤?
[錯誤] Currencyconvertor3.dpr(75): 'END' 預期,但 'ELSE' 發現
[錯誤] Currencyconvertor3 .dpr(88):聲明預期,但識別符 'closefile' 發現
[錯誤] Currencyconvertor3.dpr(90): ''預期但'''發現
*我得到一個錯誤*是不是一個有用的問題說明。你知道究竟** **你得到了什麼錯誤,並沒有什麼理由讓你不包括對我們來說也是如此。 – 2015-02-24 17:50:34
遺憾將編輯成我的帖子 – SidTheSloth 2015-02-24 17:51:35
你得到的錯誤消息是問題的一個明確的指示和如何解決針鋒相對。刪除冒犯的分號';'解決了錯誤。您提到的其他錯誤不會在您提供的代碼中出現。 – 2015-02-24 19:39:17