.


:




:

































 

 

 

 





#define < > <> /* , C */

#define PI 3.14159

. # (;).

.
const < >: <> = <>; [< >: < > = <>;]

const n: integer = -10;

const < > = <>; [< > = <>;]

const n = -10;

[Private|Public] Const < > As <> = <>

Const PI As Single = 3.14159

 

[Private|Public] Const < > = <>

Const PI=3.14159


 

. , , . , , .
//   /* () */ { ( Pascal) }   (* . (Object Pascal Delphi) *)   // . (Object Pascal)
, . , . .
C++
::
[ ], (),. (), ->, ++ --
++ --, &, *, +, -,!
*, /, %, +, -  
<<, >>  
() <, >, <=, >=, ==,!=  
&, ^, |  
&&, ||  
?:
=, *=, /=, %=, +=, -=, <<=, >>=, &=, ^=, |=
, ()

 

Pascal
()
+, -, not, @, ^, #
*, /, div, mod, and, shl, shr, as
+, -, or, xor
() =, <>, >, <, <=, >=, in, is

 

Basic
()
+, -, ^
*, /, \, mod
+, -
() =, <>, >, <, <=, >=
( ) Not, And, Or, Xor

 

(. statement) ; . .
; ;
, , , .
C++
{ // <>; <>; } //
Pascal
begin // <>; <> end //
Basic Basic . .
. - .
< > = <>|<>;

var1 = 20;

var2 = var1+10;

< >:= <>|<>;

var1 := 20;

var2 := var1+10;

< > = <>|<>

var1 = 20

var2 = var1+10

. , . . . , , , . , .
long double
double  
float  
long  
int  
short  
char

 

extended
double  
real  
longint  
integer  
smallint  
shortint

 

double
single  
long  
integer  
byte

 


 

, () . - .
if
if (<>) <>; [else <>;]   if (<>) { <>; <>; } [else { <>; <>; }]   elseif

if ( a>10 ) a=1;

if ( a<10 ) a=11; else a=1;

if ( a==10 ) { a=1; b=2 ;}

if ( a<>10 ) { a=2; b=1 ;}else{ a=1; b=2 ;}

if
if <> then <> [else <>];   if <> then begin <>; <> end [else begin <>; <> end];  

if a>10 then a:=1;

if a<10 then a:=11 else a:=1;

if a=10 thenbegin a:=1; b:=2 end;

if a<>10 thenbegin a:=2; b:=1 end else begin a:=1; b:=2 end;

if
If <> Then <> [Else <>]   If <> Then <> <> [Else <> <>] End If     elseif

If a>10 Then a=1

If a<10 Then a=11 Else a=1

If a=10 Then

a=1

b=2

End If

If a<>10 Then

a=2

b=1

Else

a=1

b=2

End If


 

switch
switch (< >) { case <_1>: <>; [break;] ... case <_n>: <>; [break;] [default: <>;] }

 

switch ( 2*2 )

{

case 1: n=1;

case 2: n=2;

case 3: n=3;

default: n=4;

}

 

 

case , . case . Break .

case
case < > of <_1>: <>; ... <_n>: <>; [else <>;] end;    

 

Case (2*2) of

1: n:=1;

2: n:=2;

3: n:=3;

else: n:=4;

end;

 

Case .

select
Select Case < > Case <_1>: <> ... Case <_n>: <> [Case Else <>] End Select  

 

Select Case 2*2

Case 1:

n=1

Case 2:

n=2

Case 3:

n=3

Case Else:

n=4

End Select

 

Case , .


 

, . , , . . , , , ( , ). , , . , , (, ), . . , : 1 , 2 , 3 . . : 1. ( ) . - . 2. , , . , ( ). - . 3. , . , . - .
C++ ( )
for (< >[,< >];< >;< >[,< >]) <>;   for (< >[,< >];< >;< >[,< >]) { <>; <>; }

for ( j=0; j<15; j++ ) n++;

for ( j=0; j<15; j++ ) { n++; k-- ;}

for ( j=0, i=1; j<15; j++, i-- ) n++;

Pascal ( )
for <>:=<. > to|downto <. > do <>;     Exit .   1 to, downto .

for j := 0 to 15 do n:=n+1;

for j := 15 downto 0 do n:=n+1;

for j := 0 to 15 do begin n:=n+1 end;

Basic
For <>=<. > To <. > [Step <>] <> [Exit For] <> Next [<>]     ( +1). Exit For .

For j = 0 To 15

n=n+1

Next j


 

C++
while (< >) <>;   while (< >) { <>; <>; }

while ( j<15 ) j++;

Pascal
while < > do <>;     Exit .

while i<=100 do
begin s:=s+i; i:=i+1 end;

Basic
Do While < > <> [Exit Do] <> Loop   Exit Do .

Do While i<10

s=s+i

i=i+1

Loop

C++
do <>; while (< >);   do { <>; <>; } while (< >);  

do { s=s+i; i-- ;} while ( i>10 )

Pascal
repeat <>; until < >;     Exit . ( ).

repeat s:=s+i; i:=i-1 until i>10;

Basic
Do <> [Exit Do] <> Loop Until< >     Exit Do .    

Do

s=s+i

i=i-1

Loop Until i>10

. . , . , . . . , 10 , 10 , 100 1000 . : 1 , 2 , .

 

C++ break;/* break, , ( switch) */ continue;/* */ goto<>;/* */ Pascal break;{ break, , } continue;{ } goto<>;{ } Basic Exit For/Do Exit For/Do, ,     GoTo<>
/ . - . , .
C++
>> cin   #include <iostream> using namespace std;   cin >> < > [>> < >];   , .. .  

#include <iostream>

using namespace std;

void main()

{

int ftemp;

cin>> ftemp

}

Pascal
Read(< > [,< >]); ReadLn(< > [,< >]);   Read , , ReadLn - . . , - Enter. , .

Read( i );

ReadLn( i,j );

Basic
< > = InputBox (<>[, <>, < >..])   . .    

I= InputBox( , , 10 )


 

C++
<< cout   #include <iostream> using namespace std;   cout << < >|<> [<< < >|<>] [<< endl];   .   endl , ( \n).

#include <iostream>

using namespace std;

void main()

{

cout << . << endl;

}

Pascal
Write(< >|<> [,< >|<>]); WriteLn(< >|<> [,< >|<>]);   Write , , , WriteLn .    

Write( a= ); ReadLn( a );

WriteLn( , a );

Basic
MsgBox (<>[,..])   .  

MsgBox( & a )


 

C++ : 1. ()
\a
\b
\f
\n .
\r
\t
\\
\
\
\xdd 16-

cout << A << \t << B;

 

2.

#include <iomanip>

endl .
setw(n) n

cout << setw(9) << << endl;

 

3. printf, sprintf

Pascal Write(A=,< >);  
< >: <- >: <- >

 

Write(A=, A:9:5);

Basic MsgBox(Format(<>|<>[, < >])   MyStr = Format(23) ' "23".   MyStr = Format(5459.4, "##,##0.00") ' "5,459.40".   MyStr = Format(334.9, "###0.00") ' "334.90".   MyStr = Format(5, "0.00%") ' "500.00%".   MyStr = Format("HELLO", "<") ' "hello".   MyStr = Format("This is it", ">") ' "THIS IS IT".     Format . , .

 

C++
[#include <>] /* */ [using namespace < >] /* , */ < > main() { <>; [return [< >];] }    

 

 

#include <iostream>

using namespace std;

int main()

{

int s=0,i=1;

while (i<=100)

{

s+=i;

i++;

}

cout << s;

return s;

}

Pascal
Program < >; [Uses < >;] [Label < >;] [Const < > = < >;] [Type < > = < >;] [Var < >: < >;] [Procedure < > < >;] [Function < > < >;] begin { } <> end. { }

: Pascal ,

program < >;

, .

 

Uses, Label, Const, Type, Var, Procedure, Function , , ;.

 

Program XXX;

Var s,i: integer;

Begin

s:=0;

i:=1;

while i<=100 do

begin

s:=s+i;

i:=i+1

end;

writeln(s=;s:5)

End.

Basic
Sub < > <> [Exit Sub] <> End Sub    

Exit Sub .

 

 

Sub XXX

Dim s As integer

Dim i As integer

s=0

i=1

Do While i<=100

s=s+i

i=i+1

Loop

MsgBox(s= & s)

End Sub


 

C++ <cstdlib> : atoll, atoi, atof. : yourDouble=atof(23dfg); yourInt=atoi(fd234); yourLong=atol(fdgb33d); <sstream> stringstream. : #include <iostream> #include <sstream> #include <string> using namespace std; int main(){ string s=100; int a; stringstream conv; conv << s; conv >> a; conv.clear(); } Pascal Val . : Val(<>,< >,< >); , . . : 0-9, +, -,., E Val(23 sdf,A,cod) {A=0, Cod=4} Basic Val . : < > = Val(<>) . , . : 0-9, +, -,., E   A=Val(23 sdf sdf) 23
, . - . : 1. - , ; 2. - , . : 1. ; 2. . , . - , , . / , . /, . , , . . : 1. , 2. , , . .

 

- C++
[#include <>] /* */ [using namespace < >] /* , */   < > < >([< >]); /* () */   < > main(){ <>;   < >([< >]); /* */   [return [< >];] }   /* */ < > < >([< >]) { <>; [return [< >];] }

() , . , .

.

.

Ũ !

 

( ) . , .

 

#include <iostream>

using namespace std;

void starline();

intmain(){

starline(); return s; }

void starline() {

for(int j=0; j<45; j++) cout << *;

cout << endl; }

 

#include <iostream>

using namespace std;

void starline() {

for(int j=0; j<45; j++) cout << *;

cout << endl; }

intmain(){

starline();

return s; }

- Pascal
Function < >[(< >)]: < >; [Uses < >;] [Label < >;] [Const < > = < >;] [Type < > = < >;] [Var < >: < >;] [Procedure < > < >;] [Function < > < >;] begin { } <> < >:=< > end; { }      

Ũ !

 

 

Program Pr;

Var a,b: integer;

Function summ(a,b: integer): integer;

Begin

summ:=a+b;

end;

Begin

Read(a,b);

Write(summ(a,b));

End.

- Basic
Function < >(< >) [As < >] <> [Exit Function] <> < >=< > End Function  

 

 





:


: 2017-02-11; !; : 510 |


:

:

, , .
==> ...

1741 - | 1440 -


© 2015-2024 lektsii.org - -

: 0.145 .