. . . . 2 .
: .
: , . .
: Windows, Pascal ABC.
Pascal ABC , . , . , Sqrt(9) 9, 3, 9.
Length(s) , s. . , FRASA. , FRASA, Length(s), : DL:= Length (FRASA)
DL , FRASA. FRASA , , , DL 20 ( , ).
. - FRASA. : , , .
Abs(x) .
. , -3 3; +3 3.
program N_14_1;
var x:real;
begin
write(' x=');
readln(x);
writeln(' =', Abs(x):5:2);
end.
Exp(x)
Exp(x) ex, x - - , 2.718282. Exp = Exp(1)
program N_14_2;
var
i:integer;
begin
for i:=-1 to 12 do
begin
writeln('EXP ',I,'=',Exp(I):10:4)
end;
end.
Ln(x)
LN(x) ( ). , ( ). - , , , .
program N_14_3;
var
i:integer;
begin
for i:=1 to 12 do
begin
writeln(' ',I:2,' = ',Ln(I):5:4)
|
|
end;
end.
Int(x) Round(x)
Int(x) . Round(x) .
program N_14_4;
var
i:integer;
:real;
const
s:array [1..6]of real = (3.1, -3.1, 3.5, -3.5, 3.9, -3.9);
begin
for i:=1 to 6 do
begin
:=s[i];
writeln('.= ',:4:1,' = ',Int():4:0,' .= ',Round():4)
end;
end.
Random(x) Random
Random(x) 0 x-1.
Random , 0 1.
program N_14_5;
var
i,k:integer;
a:real;
begin
cls;
for i:=1 to 6 do
begin
k:=random(12);
a:=random;
write(' =',k:3);
writeln(' =',a:5:2)
end;
end.
Sqrt(x)
Sqrt(x) . .
program N_7_6;
var
i:integer;
begin
cls;
for i:=1 to 6 do
begin
writeln('= ',i:2,' = ',Sqrt(i):6:4)
end;
end.
Arctan(x) . . 180/ π.
Cos(x), Sin(x)
Cos(x), Sin(x) , . .
Val(s,v,code)
Val (s - string, v - integer, real, code integer) . s v. , code 0, , code Val "_" (0 - 9, +, -,., ). "_" , Val 0. (, ) . Val , .
program N_14_7;
var
ss:string;
code:integer;
v:real;
begin
write(':');
read(ss);
val(ss,v,code);
writeln('= ',v:4:3,' = ',code:4);
end.
, . .
1. .
2. .
3. (, , -).
4. .
5. .
6. .
7. .
1.
, . . , ?
|
|
1.
2. (-, )
3.
4.
5.
6.
7.
. , . , , .
. , , . , - ( ).
. . , . - . , . , , . , . , . , . , , . , , , , . . , . , , . ( , . .). . ( ), . . . , , . :
, , , d, m, n
, , , d
m:=a d
n:=b c
m,n
- ( flow-chart). - . 19.701-90,
- . , . . . . (, ). ; . , , , . : . - . , .
|
|
, . , :
- ,
- ( ),
- .
, , - " " . ( ) , . MSIL, Microsoft.NET, , Java -. - , , . , . , , , , MOV AL,OOh, , (, !) 0. , . (Basic, Pascal, , Ada, Modula, PL/1, Snobol, Fortran, Delphi, Visual Basic, Visual ). , , , , . : (FORmula TRANslation) , (Common business Orientated Language) . 50- . BASIC (Beginners All-purpose Symbolic Instruction Code) . BASIC . , . , , Pascal. , , . : . , , ( () ). , , ( ). , . .
|
|
, , . , , . , . . , , : -; - ; -. , (Compile-time error), . , .
. (step-by-step), . , . , , .
. : n .
.
1. , n- . n . n=5, 1 * 3 * 5 * 7 * 9*
2. n. . . , 2. , , , .. n- . ( 14.1).
3. :
1) P = 1;
2) S = 1;
3) i = 0;
4) i < n. , 5).
;
5) i = i + 1.
;
6) i- S: P = P ⋅ S;
7) S = S + 2. ,
;
8) 4).
- :
.
6. .
n = 5. P = 945. .
i . | S | P | i < n |
14.1 .
, .
7. , .
1. , ?
2. .
3. . .
4. . .
5. .
6. . .
7. .
8. , . ?
9. .
10. 3 . .
11. ) ; ) .