End;
, :
i:=i+1;
case i mod 3 of
0: Color:=clred;
1: Color:=clblue;
2: Color:=clgreen;
End;
. . :
for i:=5 to 10 do ;
-, , , begin end. ,
res:=1;
for k:=2 to 10 do
begin
res:=res*k;
Label1.Caption:=Label1.Caption + ' ' + IntToStr(res);
End
.
:
while do ;
, . , , :
i:=1;
while MyString[i]<> do
i:=i+1;
, , . , , , :
while MyString[i]<> do
begin
i:=i+1;
if i>length(MyString) then break;
end;
5. Delphi :
procedure TForm2.FormClick(Sender: TObject); | |
var a: integer; | |
begin a:=5; height:=height+a; end; |
( , ) , . procedure.
. var. ( , ).
begin. end; .
, , . :
function TForm1.factorial (i: integer): integer;
{ i }
var res,k: integer;
Begin
res:=1;
for k:=1 to do
res:=res*k;
factorial:=res;
End;
6. Delphi.
. ( ). , . , height , width , left top . , , , . , Form1.height , Button1.width ..
( ) . (, ) . . ( Objects Inspector Parameters ) ( ). . , (, - ) !
, . .
- , . ( , , ) . , .
|
|
TLabel: . - Caption string, , :
Label1.Caption:='¡hola!';
,
Label1.Caption:=Label1.Caption+'¡hola!';
, ' ', , #13.
TEdit: . Text. , :
:=StrToInt(Edit1.Text);
TButton. Caption.
TMemo. (, , ) . 0. 7, Memo1.Lines[7]. , , Memo1.Lines[3][2].
, Memo1.Lines.Add(Novaia stroka);. ( Memo1.Lines.):
Clear
Count ( count 1)
Delete(5) 5.
Insert(5, privet) 5-
LoadFromFile(a.txt)
SaveToFile(a.txt) .
.
TStringList, ( ), , . . , , .
procedure TForm2.FormCreate(Sender: TObject);
var MyFile: TstringList; k:integer; LargestLine:string;
Begin
MyFile:=TStringList.Create;
MyFile.LoadFromFile('c:\a.txt');
LargestLine:='';
for k:=0 to MyFile.Count - 1 do
if length(MyFile[k])>length(LargestLine) then LargestLine:=MyFile[k];
ShowMessage('The largest line is '+LargestLine);
MyFile.Free;
Application.Terminate;
End;
|
|
.
, . ( OnCreate)
application.OnException:=MyExcept;
, :
procedure TForm2.MyExcept (Sender: TObject; E: Exception);
Begin
Label1.Caption:=' !!!'
end;
. , :
if E=EZeroDivide then ShowMessage(' !')
else ShowMessage( - );
.
- , . .
10.
|x| | bs (x) | n |
[x] | Trunc(x) | x |
{x} | Frac(x) | X |
√x | Sqrt (x) | x |
x2 | Sqr (x) | x |
Sin x | Sin (x) | x |
Cos x | Cos (x) | x |
arctg x | Arctan (x) | x |
ex | (x) | x |
ln x | Ln(x) | x |
Pi | ||
xn | exp(n*ln(x)) | n |
n√x | exp(1/n*ln(x)) | n- |
Rardom(n) | 0 n- 1 |