: , , .
:
< >;
< >.
, . . , . - :
, , , , , .
- . , . . , .
if <>
then <, >
else <, >;.
, , , .
.
() , .
( ). .
( ). .
(), ( ).
: , ; , ..
- , , . .
:
- , ;
|
|
;
, .
- , . . (). , .
.
, :
- , , ;
- . ;
- , ;
- , ;
- . .
. .
, , , . , .
:
;
-pp ();
- ( ).
- , . , . .
. , . . , .
, . . , , , .
|
|
, , , - ().
- , . , .
( ) , , . , (, ) , .
, . , , , . , , , , . , , , , .
, , , . . , , , Object Pascal C, .
, , . , . , . . , , . .
, . , , . , . . , . , , , .
, :
, ;
, , , ;
, ;
|
|
;
, ;
.
, -. .
:
,
,
.
, .. " ", .
, , . , , , .
. , , , , .
:
();
;
-.
() . .
- . , , : , . , - , . , , , , , .
, . , 10-15 . : - , - , , .
. , , .
60- . - . PL/1, PASCAL, C, C+, , . , , - .
(Prolog, Lisp, Mercury, KLO .) , , . . .
|
|
- (Object Pascal, C++, Java, Objective Caml. .). - - . () , , . - , . - , , .
- , , , . , .
, () .
( , ) :
Program < () >;
Uses < , >; { , }
Label < ( ), >; { }
Const < ( ), >; { }
Type < , >; { }
Var < , >;{ }
{ < > }
{ < > }
Begin
< , >; { }
< ( )>; { }
< ( ), >; { }
End.
. v r h.
Program Vil;
Uses Crt { / " " }
Const pi = 3.14;
Var r, h, v: real;
{ r h }
{ v }
Begin
ClrScr; { ( ) }
ReadLn (r, h); { }
v:=pi*r*r*h; { }
WriteLn ( , v) { }
End.
.
sqr(x) | |
x | sqrt (x) |
|| | abs (x) |
sin x | sin(x) |
cos x | cos(x) |
tg x | tg(x) |
ctg x | ctg(x) |
arcsin x | arcsin (x) |
arccos x | arccos(x) |
arctg x | arctg(x) |
ln x | ln(x) |
= 2, 7... x | exp(x) |
x mod y | |
y | x div y |
() | int(x) |
0 | rnd(x) |
length (x) |
. : sqrt(9) = 3, abs(5) = 5, sin(0) = 0, cos(0) = 1, ln(1) = 0, exp(1) =e, 23 mod 5 = 3, 20 mod 5 = 0, 23 div 5 = 4, 20 div 5 = 4, int(2.7) = 2, int(2) = 2, rnd(0) = 0.231356, length() = 6.
( ) :
;
;
( "*" "/");
( "+" "").
.
() ():
Program < >;,
< > , (, , ).
( ) :
Read (< >);
ReadLn (< >);.
( ), .
|
|
:
Write (< >);
WriteLn (< >);.
( ), .
:
<> := <>;,
<> , <> . ":=" : <> , <>, , <>.
() Begin.
() End.
:
< > { }.
. , , , .
, .
. () . : , ; , , , . ()
Program SPM1;
Uses Crt;
Var x: array [1..100] of real;
n, i: integer;
s, : real;
Begin
ClrScr;
WriteLn(' :'); { }
ReadLn(n); { }
WriteLn(' :'); { }
for i:=1 to n do { }
begin
write('x[',i,']='); { }
readln(x[i]) { }
end;
s:=0; { }
p:=1; { [u1]}
for i:=1 to n do { }
begin
s:=s+x[i]; { }
p:=p*x[i] { }
end;
WriteLn(' ', s: 3:3); { }
WriteLn(' ', p: 3:3); { }
End.
. , n. , n .
"" 2.
()
Program Summa;
Uses Crt; { / " "}
Var i, n, s: real;
{ 1, 3, 5, , }
{ s , s > n }
Begin
ClrScr; { ( ) }
ReadLn (n); { }
s:=1; { }
i:=1; { }
while (s<=n) do { ( ) }
begin
i:=i+2; { }
s:=s+i { }
end;
WriteLn ( , s); { }
End.