.


:




:

































 

 

 

 


(),




Program Logic;

{$APPTYPE CONSOLE}

Uses

SysUtils;

Var

i,j:Integer;

K:Byte;

b,c,d:Boolean;

Begin

//

b:=True; c:=False;

b:=Boolean(1); c:=Boolean(0);

Byte(b):=1; Byte(b):=0;

2) : , . , , . Uses , , . , ; .

3) Var. Var, : . , : **:=**. . Var , = .

2:

 

1)

Û y:=Int(x);

Û y:=Frac(x);

Û i:=Round(x);

Û i:=Trunc(x);

Û i:=Floor(x); (. Math)

Û i:=Ceil(x); (. Math)

|x| Û y:=Abs(x);

 

,

x2 Û y:=Sqr(x);

Öx Û y:=Sqrt(x);

ex Û y:=Exp(x);

ln x Û y:=Ln(x);

lg x Û y:=Log10 (x); (. Math)

logi x Û y:= LogN (i,x); (. Math)

xi Û y:=Power(x, i); (. Math)

: x i Û y:=Exp(i * Ln(x));

 

sin x Û y:=Sin(x);

cos x Û y:=Cos(x);

arctg x Û y:=ArcTan(x);

p Û y:=Pi;

: Tg(x) Û y:=Sin(x) / Cos(x);

: Ctg(x) Û y:=Cos(x) / Sin(x);

: ArcSin(x), |x|<1 Û y:=ArcTan(x / Sqrt(1-x*x));

: ArcCos(x), |x|<1 Û y:=Pi/2 - ArcTan(x/ Sqrt(1-x*x));

i j Û i:=j Mod k;

i j Û i:=j Div k;

: Û k:=i Mod 10;

: Û k:=i Div Round(

Exp(

Trunc(Ln(i) / Ln(10)) * Ln(10)));

 

2) , : , : sqrt(Abs(x-(2*y)))

3) () IntToStr(x) ( ) , . Trunc(x)

4) MATH

function ArcCos(X: Extended): Extended;
function ArcSin(X: Extended): Extended;
function ArcTan2(Y, X: Extended): Ex tended; Y/X ( System )
function Cotan(X: Extended): Extended;
function Hypot (X, Y: Extended): Extended; (X** 2 + Y** 2)-
procedure SinCos (Theta: Extended; va: '"Sin, Cos: Extended); Theta ( 2 , )
function Tan(X: Extended): Extended;
function CycleToRad(Cycles: Extended): Extended; Radians := Cycles * 2PI
function DegToRad(Degrees: Extended) Extended; Radians:= Degrees * PI / 18
function GradToRad(Grads: Extended): Extended; Radians:= Grads * PI / 200
function RadToDeg(Radians: Extended) Extended; Degrees:= Radians * 180 / PI
function RadToGrad(Radians: Extended): Extended; Grads:= Radians * 200 / PI
function RadToCycle(Radians: Extended): Extended; Cycles:= Radians / 2PI

5)

function ArcCosh(X: Extended): Extended;
function ArcSinh(X: Extended): Extended;
function ArcTanh(X: Extended): Extended;
function Cosh(X: Extended): Extended;
function Sinh(X: Extended): Extended;
function Tanh(X: Extended): Extended;
Function LnXP1 (X: Extended): Exteaded; (+1). ,
Function Log10(X: Extended): Extended;
Function Log2(X: Extended): Extended;
function LogN(Base, X: Extended): Extended; X Base
function IntPower(Base: Extended; Expopient: Integer): Extended; Base Exponent
function Power(Base, Exponent: Extended): Extended; Base Exponent
function Ceil(X: Extended): Integer;
function Floor (X: Extended): Integer;
procedure Frexp(X: Extended; var Mantissa: Extended; var Exponent: Integer);
function Ldexp(X: Extended; P: Integer): Extended; **P
function (,: Int64): Int64; overload;  
function (, : Integer): Integer; overloads;
function Poly(X: Extended; const Coefficients: array of Double): Extended; A*X"+B*X" '+...+Z.
function (,: Single): Single/overload;  
function Max(,: Double): Double/overload;  
function Max(,: Extended): Extended; overload;  
function MaxIntValue(const Data: array of Integer): Integer;
function MaxValue(const Data: array of Double): Double;
function Mean(const Data: array of Double): Extended;
procedure MeanAndStdDev(const Data: array of Double; var Mean, StdDev: Extended);
function Min(,: Integer): Integer/overload/function Min(,: Int64): Int64; overload;
function Min(A,B: Single): Single/overload; function Min(A,B: Double): Double; overload/function Min(A,B: Extended): Extended; overload/  
function MinIntValue(const Data: array of Integer): Integer;
function MinValue(const Data: array of Double): Double;
procedure MomentSkewKurtosis (const Data: array of Double; var Ml, M2, , 4, Skew, Kurtosis: Extended); , Skew Kurtosis
function Norm(const Data: array of Double): Extended; ( )
function PopnStdDev(const Data: array of Double): Extended; . , (. PopnVariance)
function PopnVariance(const Data: array of Double): Extended; . TotalVariance/N (. TotalVariance)
function RandG(Mean, StdDev: Extended): Extended; Mean StdDev
function StdDev(const Data: array of Double): Extended;
function Sum(const Data: array"orDouble): Extended register;
procedure SumsAndSquares(const Data: array of Double;
function Sumint(const Data: array of Integer): Integer register;
function SumOfSquares(const Data: array of Double): Extended;
function TotalVariance(const Data: array of Double): Extended;
function Variance(const Data: array of Double): Extended; . ^ TotalVariance/(N-1)
type TPaymentTime = (ptEndOfPeriod, ptStartOfPeriod); ,
function DoubleDecliningBalance (Cost, Salvage: Extended; Life, Period: Integer): Extended;
function FutureValue(Rate: Extended; NPeriods: Integer; Payment, Pre-sentValue: Extended; PaymentTime: TPaymentTime): Extended;
- function InterestPayment(Rate: Extended; Period, NPeriods: Integer; PresentValue, FutureValue: Extended; PaymentTime: TPaymentTime): Extended;
function InterestRate(NPeriods: Integer; Payment, PresentValue, Future-Value: Extended; PaymentTime: TPaymentTime): Extended; ,
function InternalRateOfReturn (Guess: Extended} const CashFlows: array of Double): Extended;
function NetPresentValue(Rate: Extended; const CashFlows: array of Double; PaymentTime: TPaymentTime): Extended;
function NumberOfPeriods(Rate, Payment, PresentValue, FutureValue: Extended; PaymentTime: TPaymentTime): Extended/ ,
function Payment(Rate: Extended; NPeriods: Integer; PresentValue, Future-Value: Extended; PaymentTime: TPaymentTime): Extended/ , ,
function PeriodPayment(Rate: Extended; Period, NPeriods: Integer; PresentValue, FutureValu'e: Extended; PaymentTime: TPaymentTime): Extended;
function PresentValue(Rate: Extended; NPeriods: Integer; Payment, Future-Value: Extended; PaymentTime: TPaymentTime): Extended;
function SLNDepreciation (Cost, Salvage: Extended; Life: Integer): Extended;
function SYDDepreciation (Cost, Salvage: Extended; Life, Period: Integer): Extended;

6) Math Uses.

 

 

3:

Program Logic;

{$APPTYPE CONSOLE}

Uses

SysUtils;

Var

i,j:Integer;

K:Byte;

b,c,d:Boolean;

Begin

b:=True; c:=False;

b:=Boolean(1); c:=Boolean(0);

Byte(b):=1; Byte(b):=0;

//

i:=Byte(b); Boolean(k):=b;

b:=1<2; c:=1>2; d:=1=1;

b:=1<=2; c:=1>=2; d:=1<>1;

d:=b And c; ( )

d:=b Or c; ( )

d:=b Xor c; ( )

d:=Not b; ( )

4) // :=Byte(b); writeln(x);

//

b:=Frac(Sqrt(i))=0; // i -

b:=(0<=i) And (i<9); // i [0; 9)

WriteLn(b);

ReadLn;

End.

 

4:

1) , . . ,

2)

 

(),

If Then Else () () ()

:

If Then
1  
Else  
2;  

:

If Then
1;  

3) ( ) , begin end;

4) :

// //

Var a: Real;

Begin

If Frac(a)=0 then begin a:=1/a; writeln(a);

End;

Readln;

end.

5: (.)

1) Read/Readln(x); , .

2) , , .

3) Random, 0 99 : Var a:=Array[1..10] of Integer; i:integer;

Randomize;

Begin

For i=1 to 10 Do a[i]:=Random(100); Randomize , Randomize , .

4) Write/Writeln() , . , Writeln(x:2:4) , .

6

 

Program Cicle_Repeat;

{$APPTYPE CONSOLE}

Uses

SysUtils;

Var

N:Integer;

Begin

//

// REPEAT UNTIL

// () ( , )

//

2)

// :

// -----------------------------------

// | Repeat |

// | | <-

// | Until ; |

// -----------------------------------

3) Continue, Break.

4)

//==================================

//.

//------

// 1,

// 4, 5, 6

// 1

//==================================

n:=1; //

Repeat //

n:=n+1; //

Until ((n Mod 4)=1) And //

((n Mod 5)=1) And //

((n Mod 6)=1);

WriteLn('Result: ',n); //

ReadLn; //

End.

//====================================

//

//====================================

Write('n = '); //

ReadLn(n); // n

m:=2; //

Repeat //

If n Mod m=0 Then // n m,

Begin

n:=n Div m; // n

Write(m,' '); //

End

Else m:=m+1; // m

Until n=1; // -

Writeln;

//=====================================

//

//=====================================

Repeat //

Write('n = '); ReadLn(n); // n

Until n>0; // -

m:=0; //

Repeat //

m:=m+n Mod 10; //

n:=n Div 10; //

Until n=0; // -

WriteLn('Result: ',m);

//===============================

//

//===============================

Repeat //

Write('n = '); ReadLn(n); // n

Until n>0; // -

m:=0; //

Repeat //

m:=10*m+n Mod 10; //

n:=n Div 10; //

Until n=0; // -

WriteLn('Result: ',m);

7

//

// WHILE DO

// () ()

//

2)

// :

// -----------------------------------

// While Do

// <-

// -----------------------------------

3) , .

4)

//=========================

//

//=========================

Write('n = '); ReadLn(n); // n

n:=Abs(n); //

While n>9 Do //

n:=n Div 10; //

WriteLn('Result: ',n);

//========================

//

//========================

Write('n m = '); ReadLn(n,m); // n, m

n:=Abs(n); m:=Abs(m); //

While m<>0 Do //

Begin

p:=n Mod m; //

n:=m; m:=p; //

End;

WriteLn('Result: ',n);

ReadLn;

End.

8:

1) , . , , , .. False 0 True 1, , 0 255, , ..

2) , Ord, Ord(A) 65. , . , Pred(x); - Succ(x); Write(Pred(A), Succ(A)); @B.

3) for, to(DownTo), Do : , (), . , ( ). , , , : Var i:integer

Begin

5 10, .

1 ; , , (.. ) , , , , . :

Var i,n,s:integer; c:char;

Begin ( )

Write(Result );

For c:= To #255 Do

Write(c);

:

Write(n= ); Readln(n);

For i=1 To Abs(n) Do

If n Mod i=0 then write(I, );

Writeln;

:

Write(n= ); Readln(n);

c:=Y;

For i=2 To Trunc(Sqrt(Abs(n))) Do

If n Mod i=0 Then Begin c:=N; Break; End;

Writeln(Result ,c);

//========================================

//

// 3 3 3 2

// 1 + 2 +... + N = (1+2+...+N)

//========================================

Write('n = '); ReadLn(n);

c:='Y';

s:=0;

For i:=1 To n Do

Begin

s:=s+i*i*i;

If 4*s<>sqr(i*(i+1)) Then c:='N'; //

End;

WriteLn('Result: ',c);

ReadLn;

End.

 

4) L

9:

1) 1 2 , , , 1, 2, , 3, 2 : 1, 2, 3. , , , , Case, of, else, end. Case of , , , , : , . ;. else, ( ) End;.

2) , , . , , .

3) , else, else , , .

 

Program _Case;

{$APPTYPE CONSOLE}

Uses

SysUtils;

//==================================

//

//( )

//==================================

Label

Met,Met1,Met2;

Var

n,i:Integer;

b:Byte;

S:String;

Begin

//----------------------------------

//

//----------------------------------

Repeat

Write(Number of task: ); ReadLn(i);

Until (i>0) And (i<3);

Case i Of

Goto Met1;

Goto Met2;

End;

//----------------------------------

//1.

//----------------------------------

Met1:

Write('1. Number: '); ReadLn(n); //

S:=IntToStr(n)+' '; //

If (n Div 10) Mod 10=1 Then i:=0 //... 0,

Else i:=n Mod 10; //

Case i Of // i

0,5..9: S:=S+''; // 0 59

1: S:=S+ // 1

Else

S:=S+; // 2..4

End;

Goto Met; // S

//----------------------------------

//2. b- ( )

//----------------------------------

Met2:

Write(3. Number: ); ReadLn(S); //

Write('Base: '); ReadLn(b); //

n:=0; S:=UpperCase(S); //

For i:=1 To Length(S) Do //

Case S[i] Of //

0..9:

n:=n*b+Ord(S[i])-Ord(0) //-

Else

n:=n*b+Ord(S[i])-Ord(A)+10; //-

End;

S:=' '+IntToStr(b)+ //

'- '+S+

+IntToStr(n);

Goto Met; // S

//----------------------------------

// -

//----------------------------------

Met:

For i:=1 To Length(s) Do //

Begin

b:=Ord(s[i]); //

Case b Of

192..239: s[i]:=chr(b-64); //

240..255: s[i]:=chr(b-16); //

168: s[i]:=chr(240); //

184: s[i]:=chr(241); //

End;

End;

WriteLn(S);

//----------------------------------

ReadLn;

End.

10:

. , : 1) 2) . , ( , , ) . , . . , , , .. , , , : [-2..5]; [A..D]; [False..True]. . Array, . , 1 .

: : Array[] of ( ). , .

, , 0. . , ( ).

. d: Array of integer; . , , : SetLength(d,10). : d[1]; s[A]. , ( ). Size of , Length : Size of (d[0]*Length(d0,0); Low High . , For, : For a[1]:=1 To 10 Do !

Program Poly_Array;

{$APPTYPE CONSOLE}

Uses

SysUtils;

Var

//

a,b:Array[1..4,1..8] Of Integer; //

c:Array[1..2,1..3] Of Integer= //

((3, 2,-1),

(4, 5, 0));

m,n,k:Array[1..2,1..2]Of Integer;//

//

d:Array Of Array Of Char;





:


: 2016-10-06; !; : 375 |


:

:

: , .
==> ...

1472 - | 1444 -


© 2015-2024 lektsii.org - -

: 0.27 .