.


:




:

































 

 

 

 


3.




, 2:

,, . . ,;

.

Pos.

Pos (Substr: string; S: string): Integer - Substr S Substr S. Substr , . .

. Pos(,, Edit1.Text), Edit1.Text 123 ( ) - 0; 123, - 4.

case.

procedure Inp_Rea3(Var Symb: Char; Str_Ed: string);

{Var Symb - - Inp_Real3 ;

Str_Ed , -,

}

Begin

case Symb of

'0'..'9':; //

',','.': //

Begin

if Symb = '.' //

then Symb:= ','; //

{ Str_Ed }

if Pos(',', Str_Ed) <> 0 // Str_Ed

then Symb:=Char(0); //

End;

#8:; // <Backspace>

else Symb:=Chr(0); //

End;

Inp_Real3.

procedure TForm1.LabeledEdit1KeyPress(Sender: TObject; var Key: Char );

Begin

Inp_Real4 (Key, LabeledEdit1.Text); { Key Inp_Real4

End;

. procedure Inp_Real3(Var Symb: Char; Str_Ed: string)
Symb  
Symb = '.'  
true
Chr(0)
Symb
0..9:
,, .:
#8:  
true
Symb:=,  
else true
,? Pos(',', Str_Ed) <> 0
Chr(0)

4.

.

 

X n .

1 Ln(X: Real): Real, X, Exp(X: Real): Real, .

2 function Fxn(X, n: Real): Real;

3 :

X=0, Fxn=0;

X<0 |X|n ;

n=0, Fxn=1. .

 

function FXn(X, n: Real):Real; //X n

Begin

if X=0

then Fxn:=0 // =0 0

else if n=0

then FXn:=1 // n=0 1

else if X<0

Then begin

ShowMessage('

');

FXn:= Exp(n*Ln(Abs(X)));

End;

. Xn function FXn(X, n: Real):Real
true
X=0
true
false
FXn:= Exp(n*Ln(Abs(X)))
X<0
false
false
FXn=0
true
n=0
FXn=1
FXn:= Exp(n*Ln(X))
else FXn:= Exp(n*Ln(X));

end; //

5.

Fxn(X, n: Real):Real ( 4), X0 dX, Inp_Rea3(Var Symb: Char; Str_Ed: string) 3.

//

Type

TForm1 = class(TForm)

Label1: TLabel; //

Button1: TButton; //.

LabeledEdit1: TLabeledEdit; //

LabeledEdit2: TLabeledEdit; // dX -

LabeledEdit3: TLabeledEdit; // n -

Label2: TLabel; //

{ , dX, n }

procedure LabeledEdit1KeyPress(Sender: TObject; var Key: Char);

procedure LabeledEdit2KeyPress(Sender: TObject; var Key: Char);

procedure LabeledEdit3KeyPress(Sender: TObject; va r Key: Char);

procedure Button1Click(Sender: TObject);

End;

 

var Form1: TForm1;

 

Implementation

{$R *.dfm}

Var X, dX, n: Real; //

 

procedure Inp_Real3(Var Symb: Char; Str_Ed: string);

{ . 3.}

End;

 

function FXn(X, n: Real):Real; //X n

// , 4.

End;

procedure TForm1.LabeledEdit1KeyPress(Sender: TObject; var Key: Char);

begin //

Inp_Real3(Key, LabeledEdit1.Text); //

End;

 

{ TForm1.LabeledEdit2KeyPress TForm1.LabeledEdit3KeyPress TForm1.LabeledEdit1KeyPress }

 

procedure TForm1.Button1Click(Sender: TObject);

Begin

if LabeledEdit1.Text <> '' //

then X:= StrToFloat(LabeledEdit1.Text); //

else begin ShowMessage(' X!');

exit//

End;

if LabeledEdit2.Text <> '' // d

then dX:= StrToFloat(LabeledEdit2.Text)

else begin ShowMessage(' dX');

exit//

End;

if LabeledEdit3.Text <> '' // n

then n:= StrToFloat(LabeledEdit3.Text)

else begin ShowMessage(' n!');

exit

End;

Label2.Caption:= ' X Y'+ #10+

FloatToStrF(X, ffGeneral, 5, 3)+ #9+ //

FloatToStrF(FXn(X, n), ffGeneral, 5, 3)+ #10+

// FXn(X,n)

FloatToStrF(X+dX, ffGeneral, 5, 3)+ #9 + // X+dx

FloatToStrF(FXn(X+dX, n), ffGeneral, 5, 3)+ #10 + // FXn(X+dx, n)

FloatToStrF(X+2*dX, ffGeneral, 5, 3)+ #9+ // X+2*dx

FloatToStrF(FXn(X+2*dX, n), ffGeneral, 5, 3)+ #13; // FXn(X+2*dX, n)

End;

End.

n
false
false
True
LabeledEdit1.Text <> ''  
true
LabeledEdit2.Text <> ''  
False
n X
X, FXn(X, n) X+dx, FXn(X+dx, n) X+2*dX, FXn(X+2*dX, n)
dX
 
Exit
Exit
true
. FXn(x, n) procedure TForm1.Button1Click(Sender: TObject)
X  
LabeledEdit3.Text <> ''  
dX
Exit

1. .

2. .

3. (- ).

4. .

5. .

6. , .

 

 





:


: 2016-10-27; !; : 274 |


:

:

, , 1:10
==> ...

1631 - | 1555 -


© 2015-2024 lektsii.org - -

: 0.123 .