2014-08-30 41 views
-4

即時通訊使用帕斯卡,我必須編程一個叫做7-11的遊戲,你們能給我一些提示嗎?使用帕斯卡的第一個程序

我用盡:

program sevele; 
var capitalinicial: integer 
begin 
    writeln('ingrese un capital') 
    readln(capitalinicial) 
    writeln('su capital es capitalinicial') 
+1

你錯過幾個分號和一些'end'你需要*編譯*你的源代碼。 – 2014-08-30 19:54:27

回答

1

回答你的問題,有你需要知道的幾件事:

你必須把分號;在每一個句子的末尾,除了一個關鍵字後表示控制結構的開始(用於,同時,如果,否則等)或在關鍵字beginend之後。

使用相同數量的begin s和end的關鍵字。請注意,程序中的最後一個end後面跟着一個點。

當您使用writeln時,您可以打印一個或多個變量或字符串。你必須使用簡單的引號'來打印字符串,並且只需要一個沒有任何引號的變量的名字來打印它的值,你也需要用逗號','分隔不同的參數。

例如:

program example; 
var 
    a,b:integer; 
    begin 
    a:=3; 
    b:=5; 
    writeln ('this is just a string'); 
    writeln (a); 
    writeln (a,b); 
    writeln ('the value of a is: ',a,' and the value of b is: ',b); 
    readln; 
    end. 

你attemped到可能編寫的代碼是:

program sevele; 
var capitalinicial: integer; 
begin 
    writeln('ingrese un capital'); 
    readln(capitalinicial); 
    writeln('su capital es ',capitalinicial); 
    readln; //use this to give you time to view the output 
end. 
0

這是它如何工作的

program sevele; 
var capitalinicial: integer; 
begin 
writeln('ingrese un capital'); 
readln(capitalinicial); 
writeln('su capital es',capitalinicial); 
end.