1
我有這段代碼的錯誤。有人可以告訴我哪部分是錯的嗎? 該程序應該繼續,直到用戶退出程序。例如:如果他們選擇1,那麼在選擇執行後,他們應該再次被賦予菜單,直到他們選擇退出程序。重複直到+ pascal中的菜單
program calculator;
var
a, b: integer;
c: real;
choice :integer;
begin
a:=5; b:=3;
writeln (' Welcome to computer program');
repeat
writeln (' Please select your choice (1-5) ');
writeln (' 1: addition');
writeln (' 2: subtraction');
writeln (' 3: multiplication');
writeln (' 4: dividion');
writeln (' 5: exit');
readln (choice);
case choice of
1: begin
a:=a+b;
writeln ('a: ',a);
readln;
end;
2: begin
a:=a-b ;
writeln ('a: ',a);
readln;
end;
3: begin
c:=a*b ;
writeln ('c: ',c);
readln;
end;
4: begin
a:=a div b ;
writeln ('a: ',a);
readln;
end;
5: begin
writeln (' Exit ');
halt;
end;
until choice = 5; // I've got error here but I don't know what to change.
end.
@ exo_1究竟發生了什麼?嘗試使用調試器來遍歷你的程序。 – markus