.. ., h . , , , , . , , . , Borland Enterprise Turbo Pascal, Delphi
, . , Turbo Object Pascal, :
1. ;
2. , .
-
, < / >.
[Program ( );]
Turbo Object
[Uses - , ]
{$ }
, / .
( ) :
1. ;
2. , ; BEGINEND .
Pascal- :
1. , () .
2. , .
, . ( Object Pascal 255 ).
. :
Label GoTo
Const
= ( );
MaxIndex = 100;
Pi = 3,14159;
Type
= ;
Var
: ;
x: real;
n1: integer;
.
, .
, .
|
|
V:=Exp
V , Exp .
V Exp . , , . , Exp V.
a) :=
b) :=
, , .
Type
Real1 = Real;
Real2 = Real;
.
/. .
.
text (textfile)
, , Var.
Var f: text;
.
()
text integer, real, char, string.
1. assign (AssignFile)
( , ) ( ). assign .
Assign( (, ), ( ))
:
Assign(f,c:\dir\file.txt);
2. Eof(f); . , .
3. Read(f, v1, , vn); Write(f, e1, , em); .
4. Reset(f);
() . reset read, f. Input Output , .
5. Rewrite(f);
, write, f.
reset rewrite input output. .
6. close(f) (CloseFile(f))
assign, . , .
:
, text , , . . , , .
: c1cn
ci = 0,1,
: c1cn.d1dm .
DEP , D , P . DEP = D10P
: readln(f) , writeln(f) .
|
|
readln(f, x1, , xn) Û read(f, x1, , xn); readln(f);
writeln(f, e1, , en) Û write(f, e1, , en); writeln(f);
S1; S2; ; Sn
→ .
begin S1; , Sn end
, .
1. S1; S2; ; Sn
2. begin S1; S2; ; Sn end
If B then S1 [else S2]
. If B1 then B2 then S1 else S2
, else if.
while B do S
B ( )
S
repeat S1; ; Sn until B
B ( )
, . - . . .
: , .
, .
.
.
Program N1(input, output);
Var p,b:Boolean;
x,a:integer;
begin
b:=false;
read(x);
while eof=false do
begin
read(a);
if x=a then b:=true;
end;
write(b);
end.
. .
()
() :
(cardinal)
(integer)
(char)
(boolean)
(real)
()
頠
頠
()
(array)
(string)
(set)
(record)
(file)
(text)
, ; ( ).
string text.
- integer
: [ ]
: [Low(integer), High(integer)]
: , :
: integer x integer → integer
+, , *
div ( )
mod ( ) ,
: x
sqr(x) x2
abs(x) |x|
real → integer:
trun(x)
round(x)
integer → boolean:
odd(x) (true , false )
:
≤ integer x integer → boolean
:
succ(x) x+1
pred(x) x1
ord(x)
, : , , .
:
: .
|
|
: a10b
:
[Low(real), High(real)]. ( ) .
:
Real x Real → Real
+, , *, / - real, real.
Real → Real
sin(x), cos(x), arctan(x), ln(x), sqr(x), sqrt(x), abs(x), exp(x)
≤ Real x Real → Boolean
, real ().
Exp(x)=∑xn/n!