宝蓝与微软的爱恨情仇

2022-01-11  本文已影响0人  杰_6343

Borland的诞生和发展 --Borland传奇

——我们要从历史中学会教训

编辑工具的历史

——pasic和delphi都比basic和vb小巧快捷

Pascal大多使用英文字符表示,而C大多使用符号表示

语法 pascal c

区分字母大小写 不区分 区分

模块,复合语句 begin...end; C语言是{...}

逻辑符 and  or  not &&  ||    !

赋值 x:=5; x=5;

比较符 > ,  < ,  = ,  >=,  <=,  <> > ,  < ,  = = ,  >=,  <=,  !=

运算符 +, -, *, div, mod +, -, *, /, %

常用类型 Integer;

Longint;

Int64;

Real;

Double;

Extended;

Boolean;

Int;

Long;

Long long;

Float;

Double;

Long double;

没有。(0为假,1为真)

变量说明 Var a,b:integer; Int a,b;

I:=i+1; Inc(i); I++;

I:=i-1; Dec(i); i--;

输入语句 Read(a,b); scanf(“%d%d”,&a,&b);

输出语句 Write(a,b);

Writeln(a,b); printf(“%d%d”,a,b);

printf(“%d%d\n”,a,b);

条件语句 1 If x=5 then

  Begin a:=1; b:=2 end; if (x= =5)

  { a=1;b=2;}

条件语句2 If x=5 then

  Begin a:=1; b:=2 end

Else

  Begin c:=4;d:=5 end; if (x= =5)

  { a=1;b=2;}

else

  {c=3;d=5}

条件语句3 If x=5 then begin …end

Else if x=4 then begin …end

Else if x=3 then begin …end

Else if x=2 then begin …end

Else begin … end; if(x= =5){ ..}

else if (x= =4) { …}

else if (x= =3) { …}

else if (x= =2) { …}

else {…}

开关语句 Case ch of

‘a’,’b’: 语句1;

‘c’: 语句2;

‘d’,’e’,’f’: 语句3;

… …

  Else语句n;

End; Switch(ch)

{  case ‘a’:语句1;break;

  case ‘b’:语句2;语句3;break;

  case ‘c’:语句4;break;

  … …

  defale: 语句n;

}

循环语句1 For i:=1 to 10 do

  Begin  …  end;

For i:=10 down to 1 do

  Begin … end; for(i=1;i<=10;i++)

  { … }

for(i=10;i>=1;i--)

  { … }

循环语句2 While x>5 do

  Begin  …  end; while(x>5)

  { … }

循环语句3 Repeat

  …

Until x<0; do

{ … }

while(x>=0);

跳转 Break;

Continue;

Halt; Break; 提前结束循环

Continue;本次循环跳过

没有?

数组说明 Val  a:array[0..100] of longint;

    B:array[0..10,0..10] of integer; Long a[101];

Int a[11][11];

字符数组 Var a:array[0..10] of char; Char a[11];

文件读入写出 Assign(input,’aaa.in’);reset(inpu);

Assign(outout,’aaa.out’);rewrite(output);

Close(input);close(output); Freopen(“aaa.in”,”r”,stdin);

Freopen(“aaa.out”,”w”,stdout);

上一篇 下一篇

猜你喜欢

热点阅读