.


:




:

































 

 

 

 





Borland Delphi

: , , , .

Delphi i : shortint, smallint, Longint, Int64, Byte, word Longword, .

1.1

ij
Shortint -128..127 8
Smallint -32 768.. 32 767 16
Longint -2 147 483 648.. 2 147 483 647 32
Int64   64
Byte 0..255 8 ,
Word 0..65 535 16 ,
Longword 0.. 4 294 967 295 32 ,

Delphi - Integer, Longint.

Delphi : Real, single, Double, Extended, comp, Currency. , .

1.2

ij
Real 2.9*E-39..1.7*E38 11-12  
Single 1.5 *E-45..3.4*E 38 7-8  
Double 5.0*E-324..1.7*E308 15-16  
Extended 3.4*E-4932..1.1 *E4932 19-20  
Comp 1.0.. 9.2*E18 19-20  
Currency 0.0001.. 9.2*E14 19-20  

 

Delphi : Ansichar Widechar:

Ansichar ANSI, 0 255;

widechar Unicode, 0 65 535.

Delphi - Char, Ansichar.

Delphi : shortstring WideString: shortstring ' ' 0 255 ; WideString ' , ' '. WideString Unicode-.

Delphi string. string shortstring.

1.5

True () False (). Delphi Boolean.


2

- , ' ' ' '. ʳ . - , , . ( ) , ' ( ) , () , . - , , , , .. - , . . , . , , , (), . . - ( ), . . array of.

- , , '. , , .

:

.

.

(, ).

 

:

< >: array [< >] of <>;

< > :

array - , :

< > - , :

<> - .

yjcns n n, n = k mod 3+6, (k − ).

const

n=6;

k=11;

var

a:array[1..n,1..n] of real;

b:array[1..n] of real;

. : , , Memo, StringGrid ..

(n n) A[I,j]=cos(i+j)k.

for i:=1 to n do

for j:=1 to n do

begin

a[i,j]:=cos(i+j)*k;

, (n n) n :

begin

for i:=1 to n do

for j:=1 to n do

if abs(a[i,j])< min then min:=abs(a[i,j]);

end;

. ϳ - . , , , . , . ³ , , , , , .

, , - , , , , .

.

(sortng) − , .

. г . , , .

:
, ;
, ;
, , .

. ( ) . , ( , , , ), . , . , . , .


procedure TForm1.BitBtn1Click(Sender: TObject);// 1

begin

for i:=1 to n do

for j:=1 to n do

begin

a[i,j]:=cos(i+j)*k;

StringGrid1.Cells[j-1,i-1]:=FloatToStrF(a[i,j],ffFixed,6,2);

label3.caption:=' (- j- )'

end;

end;

 

procedure TForm1.BitBtn2Click(Sender: TObject); // 2

var

min:real;

begin

for i:=1 to n do

for j:=1 to n do

if abs(a[i,j])< min then min:=abs(a[i,j]);// `

label1.caption:='̳ ` '+FloatToStrF(min,ffFixed,6,2);

label3.caption:=' , , `'

end;

 

 

procedure TForm1.BitBtn3Click(Sender: TObject); // 3

var

sb:real;

begin

for i:=1 to n do

begin

sb:=0;

for j:=1 to n do

if j mod 2<>0then sb:=sb+a[i,j];

b[i]:=sb;

stringgrid2.Cells[i-1,0]:=floattostrF(b[i],ffFixed,6,2);

label3.caption:='b[i] [i] '

end;

end;

 

 

procedure TForm1.BitBtn4Click(Sender: TObject); // 4

var

t:real;

begin

for i:=1 to n do//

c[i]:=b[i];

for i:=1 to n do

for j:=1 to n-1 do

if c[j]>c[j+1] then

begin

t:=c[j];

c[j]:=c[j+1];

c[j+1]:=t;

end;

for i:=1 to n do

StringGrid3.Cells[i-1,0]:=FloatToStrF(c[i],ffFixed,6,2);

label3.caption:=' b '

end;

 

 

procedure TForm1.BitBtn5Click(Sender: TObject); // 5

var

s:real;

begin

s:=0;

for i:=1 to n do

s:=s+sin(b[i]+c[n+1-i]);// s:=s+ +sin(b[i]+c[n+1-i])

label2.caption:='-'+floattostrF(s,ffFixed,6,2);

label3.caption:=' b c s:=s+sin(b[i]+c[n+1-i])'

end;

 

 

procedure TForm1.BitBtn6Click(Sender: TObject); // 6

var

s,t:real;

min:integer;

// -

begin

for i:=1 to n do

begin

s:=1;

for j:=1 to n do

if (j mod 2 <>0) then s:=s*a[i,j];

X[i]:=S;

stringGrid5.Cells[0,i-1]:=FloatToStr(x[i]);

end;

for i:=1 to n do

begin

y[i]:=x[i]; // x

stringGrid5.Cells[0,i-1]:=FloatToStr(y[i]);

end;

for i:=1 to n do //

for j:=1 to n do

d[i,j]:=a[i,j];

for i:=1 to n-1 do

begin

min:=i;

for j:=i+1 to n do

if y[j]<y[min] then min:=j;

t:=y[i];

y[i]:=y[min];

y[min]:=t;

for j:=1 to n do

begin

t:=d[i,j];

d[i,j]:=d[min,j];

d[min,j]:=t;

end;

label3.caption:=' '

end;

 

for i:=1 to n do

stringGrid6.Cells[0,i-1]:=FloatToStr(y[i]); //

for i:=1 to n do

for j:=1 to n do

stringGrid4.Cells[j-1,i-1]:=FloatToStrF(D[i,j],ffFixed,6,2); //

end;

 

 

procedure TForm1.BitBtn7Click(Sender: TObject); // 7

var

st:string;

begin

for i:=1 to n do

begin

st:='';

for j:=1 to n do

st:=st+' '+floattostrF(a[i,j],ffFixed,6,2); // memo1

memo1.Lines.add(st);

end;

memo1.Lines.SaveToFile('a.txt'); //

for i:=1 to n do

begin

st:='';

st:=st+' '+floattostrF(b[i],ffFixed,6,2);

memo2.Lines.add(st);

end;

memo2.Lines.SaveToFile('b.txt');

 

for i:=1 to n do

begin

st:='';

st:=st+' '+floattostrF(c[i],ffFixed,6,2);

memo3.Lines.add(st);

end;

memo3.Lines.SaveToFile('c.txt');

 

for i:=1 to n do

begin

st:='';

st:=st+' '+floattostrF(x[i],ffFixed,6,2);

memo4.Lines.add(st);

end;

memo4.Lines.SaveToFile('x.txt');

 

for i:=1 to n do

begin

st:='';

for j:=1 to n do

st:=st+' '+floattostrF(d[i,j],ffFixed,6,2);

memo5.Lines.add(st);

end;

memo5.Lines.SaveToFile('d.txt');

label3.caption:=' '

end;

 

end.

 

4 Borland Delphi

:

GroupBox1 ᒺ BitBtn. BitBtn 1-7 .

Label 1-2 .

Label 3 .

Memo 1-6

.

StringGrid 1- 6 3,4,6.

 

 





:


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


:

:

, , . , .
==> ...

1697 - | 1533 -


© 2015-2024 lektsii.org - -

: 0.048 .