2011-01-27 9 views
0

以下のコードは例外をスローします。どうして?パスカルプログラムの不正な式

program Masquerade(input, output); 
    Begin 
var amount, count, money : integer; 
writeln ('Welcome to the Wonder True Masquerade Band'); 
writeln ('Would you like to proceed? Yes/No'); 

var choice : String; 
readln (choice); 
End. 

はエラーをスローします:セミコロンは行くべきfatal: syntax error ";" expected but "identifier AMOUNT" found

答えて

5

beginvarの後に入れます。

私は長年、パスカルを使用していないし、それをテストするための任意のコンパイラを持っていないが、それは次のようにする必要があります:その通り

program Masquerade(input, output); 
var 
    amount, count, money : integer; 
begin 
    writeln ('Welcome to the Wonder True Masquerade Band'); 
... 
+2

。コードブロック内の変数をパスカルで宣言することはできません。 – CodesInChaos

関連する問題