✔ 最佳答案
Part1:
program money ;
var money1,money2 : real;
var input,output : real;
var country:integer;
var inputk,outputk : string;
var error:boolean;
begin
writeln('Please choose the kind of the input money');
writeln('1: Hong Kong dollar 2: Australian dollar 3: British pound');
writeln('4: Canadian dollar 5: Deutsche Mark 6: Japanese yen 7: US dollar');
write('Type the kind of money here:');readln(country);
If (country = 1) then begin input:=1; inputk := ' Hong Kong dollar(s)' end
else if (country = 2) then begin input:=5.94; inputk :=' Australian dollar(s)' end
else if (country = 3) then begin input:=12.04; inputk :=' British pound(s)' end
else if (country = 4) then begin input:=5.55; inputk :=' Canadian dollar(s)' end
else if (country = 5) then begin input:=4.974; inputk :=' Deusche Mark(s)' end
else if (country = 6) then begin input:=0.0768; inputk :=' Japanese yen(s)' end
else if (country = 7) then begin input:=7.76; inputk :=' US dollar(s)' end
else error:= true;
write('Please type the value of the money:');readln(money1);
呢個係我第1次整的,可以自己改善程式的不足之處
2008-10-17 22:22:13 補充:
Part 2:
writeln('Please choose the kind of the output money');
writeln('1: Hong Kong dollar 2: Australian dollar 3: British pound');
writeln('4: Canadian dollar 5: Deutsche Mark 6: Japanese yen 7: US dollar');
write('Type the kind of money here:');readln(country);
2008-10-17 22:22:47 補充:
Part 3:
If (country = 1) then begin output:=1; inputk :=' Hong Kong dollar(s)'; end
else if (country = 2) then begin output:=5.94; outputk :=' Australian dollar(s)'; end
else if (country = 3) then begin output:=12.04; outputk :=' British pound(s)'; end
2008-10-17 22:23:17 補充:
Part4:
else if (country = 4) then begin output:=5.55; outputk :=' Canadian dollar(s)'; endelse if (country = 5) then begin output:=4.974; outputk :=' Deusche Mark(s)'; end
else if (country = 6) then begin output:=0.0768; outputk :=' Japanese yen(s)'; end
2008-10-17 22:23:26 補充:
Part5:
else if (country = 7) then begin output:=7.76; outputk :=' US dollar(s)'; end
else error:= true;
If (error = true) then begin writeln('invalid input'); readln; end
else
2008-10-17 22:23:31 補充:
Part6:
begin
money2 := money1*input/output ;
writeln(money1:16:5,inputk,'=',money2:16:5,outputk);
readln;
end;
end.
2008-10-20 19:07:02 補充:
新版內容已經email send 比你,請檢查email...
今次用左case...of