c pascal
{ } begin end
/*... */ 註釋 { }
int integer(注意定義變量必須在開始,不可隨意,比如var a:integer)
變量類型名字差不多,只不過pascal一般用全稱,比如上面那個int<-> integer
浮點型一般用real
注意表達式裏如果有除法操作不許用整形(除非用trunc之類的取整後)
var a:string[200];這是定義字符串;
a:='123';
那麼a[1];a[2];a[3]裏面的內容顧名思義了,很方便
for(a;a<10;a++) for a:=1 to 10 do ;
if () then;else; if then begin end(注意這裏不能有";") else begin end;
while 那個差不多,也是while ( ) do begin end還有個就是
Repeat
until <布爾表達式>;了
case <表達式> of
<情況標號表1>:語句1;
<情況標號表2>:語句2;
:
<情況標號表n>:語句n
end;
這個和c也差不多
注意a++;++a;什麼的都沒有,這樣可以提高可讀性,dec(a); inc(a);這些有
type 那些也差不多,include和uses 差不多
函數是function,必須返回值,返回一般用
函數名:=值;(當然也可以用result,不過用函數名的多)
過程是procedure,不需要返回值(傳值的參數直接用a:integer.傳址的用var a:integer)
輸入是readln(a);
輸出是writeln(a);//這兩條不帶ln的write,read是表示不換行
數組是var a:array [1..100] of integer;相當於int a[100];不過方便的多
這是枚舉
type colortype=('red','yellow','blue','white');
var a:colortype;
變量裏有^就是指針了
還有什麼,好像基本的就這些了吧,有不懂的再回復吧,還有方便上網的畫pascal資料很多,注意delphi擴展了很多,本來的基本pascal是沒有delphi部分語法的