.


:




:

































 

 

 

 


Object Pascal

Begin

end;

. , , .. , , ( Delphi) .

: , (_). .

 

:

Procedure (Function) <>(< >);-

Label

Const

Type

Var

Begin

End;

. . . , . . . 0 9999, :

34:Label1.caption:=, ;

Object Pascal . , , . LABEL, . . :

LABEL 25,34,9,3451;

LABEL A1,A2,345,B;

.

 

. , . . , :

E=2.7818281828,

, , . : NE=-E; . CONST . , . :

CONST E=2.71828;

NE=-E;

Word='';

Maximum=100;

 

. , - . . , , . . TYPE, , , :

TYPE Index=1..20; // index 1 20

Delphi. , :

TForm1 = class (TForm)

Button1: TButton;

Private

{ Private declarations }

Public

{ Public declarations }

end;

 

. , , . . , :

I:Integer;

X:Real;

, :

I,J,K,L:Integer;

X,Y:Real;

, VAR. . , , .

:

VAR I,J,K:Integer;

X,Y,Z:Real;

M,N:Integer;

D1,D2:Day;

:

Integer -

Real -

Char -

String -

Boolean -

. . , . BEGIN, END . , END .

1: .

: OnClick Button1() . Edit1 . Label1(, ) .

:

IntToStr

StrToInt

FloatToStr

StrToFloat

procedure TForm1.Button1Click(Sender: TObject);

Var

Y,X:Integer; - Y

Begin

X:=StrToInt(edit1.text); - X text

edit1, .

Y:=X*X; - Y X * X

Label1.caption:=IntToStr(Y); - Caption

Y

end;

1: Label1.caption:=IntToStr(Y). String. Label1.caption:=Y, , .. Y:Real.

2: edit1. Text . Label.

 

, :

2: c = a + b, =10, b=3. .

procedure TForm1.Button1Click(Sender: TObject);

Const

a=10;

b=3;

Var

:Real;

Begin

:=+b;

label1.caption:=FloatToStr();

end;

 

.

1. .

2. ?

3. ?

4. ?

5. ?

6. ?

: Delphi.

: Delphi. .

. , .. , , , , Object Pascal . , , , . . , .

1. , . , , .

:

Ord(x)

Pred(x)

Succ(x)

,

Succ(10)=11

Ord(A)=65 ( )

2. . .

,
Byte 1 0...255
ShortInt 1 -128...127
SmallInt 2 -32768...32767
Word 2 0...65535
Integer 4 -2147483648...2147483647
LongInt 4 -2147483648...2147483647
LongWord 4 0...4294967295
Int64 8 -9*1018...9*1018
Cardinal 4 0...2147483647

3. . Boolean, ByteBool, Bool, WordBool, LongBool. Boolean, Object Pascal Windows. False () True ().

:

procedure TForm1.Button1Click(Sender: TObject);

Var

c:Boolean;

Begin

c:=True;

end;

4. . Char. .

:

procedure TForm1.Button1Click(Sender: TObject);

Var c:Char;

Begin

c:=A;

end;

 

5. , . , .

,

colors=(red,white, blue).

6. - , , -.

- :

< >..< >.

:

Type

dig=0..9

lchr=A..Z

7. . , . (. ).

 

,
8[1] Real 15...16 5,0*10-324...1,7*10308
4 Single 7...8 1,5*10-45...3,4*1038
8 Double 15...16 5,0*10-324...1,7*10308
10 Extended 19...20 3,4*10-4951...1,1*104932
8 Comp 19...20 -263... -263+1
8 Currency 19...20 922337203685477,5807

.

 

Object Pascal

Object Pascal . .

, Y:=X*20.

X*20 - , * - , X 20 .

 

:

+ Integer, Real Integer, Real X+Y
- Integer, Real Integer, Real X-Y
* Integer, Real Integer, Real X*Y
/ Integer, Real Real X/Y
Div Integer Integer X div Y
Mod Integer Integer X mod Y

 

, . div mod .

+, *, - : , . , . (, 10/5 ). div mod .

.



<== | ==>
 | .
:


: 2018-10-15; !; : 392 |


:

:

, .
==> ...

1736 - | 1525 -


© 2015-2024 lektsii.org - -

: 0.029 .