2016-04-24 65 views
-1

我有,因爲這代碼不會在編譯器工作的另一個問題......對於很多問題對不起,我想其他問題將遵循:定義最大帕斯卡爾

program findMaximum(input,output); 

var 
    number, Maximum: integer; 
begin 
    writeln('Insert a number and finish up with 0'). 
    while number < >0 do 
    begin 
     if number> Maximum then 
      Maximum := number; 
     readln(number) 
    end; 
    if Maximum <> 0 then 
     writeln('The biggest number is',Maximum) 
    else 
     writeln('The input was zero.') 
end. 
+0

遺憾的寫作。它是縮進的。我仍然需要學習如何在這裏發佈實際顯示爲縮進的代碼。 – Christina

+0

問題到底是什麼?是否有錯誤訊息? – Codor

+0

輸出是預期的「標識符」,但找到「WHILE」。在我被告知致命:語法錯誤,「;」預期但找到「標識符最大值」。 在這兩種情況下都存在語法錯誤*它表示* – Christina

回答

-3
var 
number, Maximum: integer; 
begin 
maximum:=0; 
writeln('Insert a number and finish up with 0'); 
while number < >0 do 
begin 
readln(number); 

if number> Maximum then Maximum := number; 
end; 

if Maximum <> 0 then 
    writeln('The biggest number is',Maximum) 
else 
    writeln('The input was zero.') 
end. 
+0

第一次寫入的行應以分號結尾,否則不帶圓點。 –

+0

是的,是一個錯字。固定。 – DrWael