.


:




:

































 

 

 

 


Pascal-

..

 

 

Turbo Pascal 7.0

 

Turbo Pascal 7.0

10

, ,

 

 

2007


33.974722

34

 

( 1 ______ 2007.)

 

 

'

-

. ..

.. - ..

: '

.. .. -

(-

. . . )

 

,

 

 

..

 

33 Turbo Pascal 7.0: ϳ. 10 . . . . : , 2007 47.

 

 

ISBN 977-7889-06-7.

33.974722

 

ISBN 977-7889-06-7. . . , 2007


 
 
 
1.1. Turbo Pascal.  
1.2. Turbo Pascal  
 
2.1.  
2.2.  
2.3. .  
Turbo pascal 7.0  
3.1. Pascal-  
Turbo Pascal  
4.1. Turbo Pascal  
4.2. Pascal-  
³ Turbo Pascal 7.0  
5.1.  
5.2.  
 
6.1. ˳  
6.1.1.  
6.2. ()  
6.2.1.  
6.3.  
6.3.1. For  
6.3.2. While  
6.3.3. Repeat  
Turbo Pascal  
7.1. .  
7.2. ϳ-.  
7.3. ϳ-.  
7.5.  
Turbo Pascal  
8.1. .  
8.2. ()  
8.3. ()  

 


 

Turbo Pascal  
9.1. . .  
9.2. .  
'  
10.1. .  
10.2. .  
10.3.  
 
Turbo Pascal 7.0  
˳  

 

, , , . , , , .

- , .

, , , .

, (Asembler) (Pascal, Delphi, C ..). , , , , ᒺ-.

Pascal . 80- - 90- . , Borland Delphi.

Pascal 1968 ͳ ³. (1623-1662). . 1983 Borland International . Pascal 1985 , , Turbo Pascal 3.0. Pascal. Pascal . Turbo Pascal 4.0 , , . (UNIT-), Modula-2. Turbo Pascal .

5.0 Turbo Pascal . (overlays). , ᒺ . , ( ) . Turbo Pascal 5.0 .

Turbo Pascal 5.5. ᒺ- (). Pascal . - ᒺ (Object), , . Object Pascal. , ᒺ- C, C++. Object Pascal Borland Delphi, 90- .

, . . ᒺ ᒺ-. Visual Basic - , Microsoft Office.

Turbo Pascal 7.0. , . Pascal , Delphi.

, , , .

: .

, , , .

Turbo Pascal 7.0, Turbo Pascal Turbo Pascal for Windows, . , .

- ( ), , , , . , .

, .

, ' .

, .

, '.

: , ( Asembler ), ( Turbo Pascal ), (Delphi).

: () , () .


Turbo Pascal. .

, , . , - , .

- , , , , , .

.

- , .

Pascal , . , , Pi=3,141592.... , , (. ).

- , . , Pascal-, (. )..

- (, , ..), ( , , , ).

Pascal . : - ; - ;

- ;

- ;

- ;

- .

- , , . :

- ;

- ;

- ;

- ;

- ;

- ;

- ;

- (, );

- ( , , , );

- ;

- ᒺ.

, Turbo Pascal . - , , , . - , .

- , ( ). , , .

- , (, ..). : + - ), - - , * - , / - , = - ..

- , 䳿 , . , - , .

Turbo Pascal . :

- (:=);

- (goto);

- ().

, . :

- - , (begin - end);

- (if);

- (case);

- (repeat, while, for);

- (with).

. , , Turbo Pascal , ASCII-. ASCII-, 128 255, : (&), (!), (%), (~), (). ֳ , ().

, , .

Turbo Pascal 7.0 , , ' .


 

˳ , , , . A...Z, a...z, 0...9, + - * / = < >[ ]{ }$ ^ & #
' (, , , , ). : , , ,_; . , begin Write Test My_First_Program
    - ', . 45, Pi
- ', . a, b, c
. { } (* *) { ) (* *)

 

 

Turbo Pascal

and array begin case const div do downto else end file for function goto if in label mod nil not of or packed - procedure program - record repeat set then to type until var while .

. , .

() : , , . , .


, . , .

', ', , ' .

'
ֳ Byte ֳ [0; 255] 1 0, 5, 245
Shortint 128..127 1 -5, 26, 96
word 0..65535 2 0, 36, 6545
Integer () ֳ [-32767; 32767] 2 457, -568, -7, 0
longint 2147483648..2147483647 4 -2356, 988456
ij single 1.510453.41038 4 236,36; 6954,369
Real () , ( 11 ) - 10 ( 10-39 1038) 6 0.4,-1.8, 0.172+3, 37-4
extended 3.4104951 1.1104932 10 0.4,-1.8, 0.172+3,
Char , 1 ', '', Y, '2'
String 255  
Boolean : True () False () 1 5<3 - True 5+8>14- False

 

:

 

 

>   < =
> = =
< < >

:

:

. , !

 

 


, , .

,
abs(x) integer, real integer, real |x|
arctan(x) integer, real real arctgx
cos(x) integer, real real cosx
sin(x) integer, real real sinx
exp(x) integer, real real ex
ln(x) integer, real real lnx
sqrt(x) integer, real real
sqr(x) integer, real integer, real x2
ord(x) integer ASCII-
succ(x) x
pred(x) x
round(x) real integer
trunc(x) real integer
int(x) real real
frac(x) real real
odd(x) integer boolean true (x ), false (x )
random(x) integer integer 0 x
upcase(x) char char
:
inc(x,y) integer integer x y
inc(x) integer, char integer, char x 1
dec(x,y) integer integer x y
dec(x) integer, char integer, char x 1

:

1. . , :

:

(a*x+b*sqr(x)+c*sqr(x)*x)/(14*x-x).

2. , , , , .

. .

:

1) ;

2) ;

3) , , mod div;

4) .


Turbo pascal 7.0

, (, ), , . , , , .

, .

Program - , '. Turbo Pascal 6.0 , , .

, , , PROGRAM 䳺 . , , , Turbo Pascal.

Uses - , . , , 㳿 Pascal. , , , ( ) , , , .. . ( , .., ), .

, USES , ( ( )).

Label - , , . , LABEL .

: Pascal- , Pascal. , .

Const - . , ( ) Const . , , Pascal, .

Type - . . , .

Var - , . , , , ' var. , Pascal-.

, , ( USES). , - ( ). - , - , . .

- . . begin end, .

Pascal-

1. - begin end, . . , , , ( ).

2. (;) - , .

3. ϳ , end, (;) , , end .

4. Pascal , .

5. , ( - (*,,, *)).

6. , - , .

7. , , begin end. begin end.

8. , , , const, type var.

' ( " ")

1. ϳ begin , end, (, begin).

2. , - .

. , .

:=- := , ', , , :=2 X:= + 2 - Z Name:= ''
Read () Read(a1, a2,...,n), 1, 2,...,n , , . <Enter>. <Enter> Read (Name) Read (, , , Z)
Readln ϳ 1, 2,...,n
Write () Write(a1, a2,...,n), 1, 2,...,n (, , , ) Write ('³',2) ³ 2 Write(',', Name,'!') , !
Writeln ϳ 1, 2,...,n
         

. ϳ ; ( ). . ().

³

Turbo Pascal 7.0

Turbo Pascal 7.0 :

 

:

F10. :

  • File. 䳿 ( , ..)
  • Edit. (, , , ..)
  • Search. .
  • Run. , .
  • Compile. .
  • Debug. ̳ , .
  • Tools. ̳ .
  • Options. .
  • Window. (, , , ).
  • Help. .

. Alt , . .

- , , . - . ' - .

.

.

  • Ctrl+F9 (, )
  • Alt+F5 -
  • F2 -
  • F3 -
  • Alt+F3 -
  • Alt+X -
  • F1 -
  • Ctrl+F1 - ,
  • Alt+Backspace -
  • Ctrl+Y -
  • Shift+ -
  • Ctrl+Insert -
  • Shift+Insert -

( ) . , ' .

:

( );

();

().

˳

˳ , , .

 
 


- (.1)

 

˳ , (. 2)

˳ ( ) , , - .

. 1 . 2

() , , .

() , .


1. .

, ' () BEGIN END.

ֳ .

:

BEGIN <1 >; <2 >; <3 >; *** < n > END;

- , .

BEGIN END ;; .

1. ( ):

BEGIN

Suma:=Suma+Cina;

N:=N+1

END;

.

, .

GOTO <>

:

:

LABEL < >.
<>: <>

( ) , :

 

1. GOTO .

2. Turbo (Borland) Pascal 7.0 PROGRAM . 7.0 .

3. Dz IF

() , , .

. true () false (). . , 璺 , , 璺 : not, and i or.

.

  1. :
if <> then <1> else <2>;

ij : , 1, 2.

2. :

f <> then<>;

ij : , , , .

, , if , then , else .

. .

.

1. : <5, >=, =0,<b

2. (>5) and (a<10), (=2) or (b=3)

and , or (), not . . .

 

 

 

4. CASE

. ̳ .

̳ 0 9999 ( ' ).

. .

()

, , , .

:

!! : =, =̳
Case <> of

1:<1>;

2:<2>;

:<M>

End;

ij : , , , , , end.

, case of, . , , . ij .

̳ , . . , .

.

.

̳ Label Goto.

.

, .

Program PORA;

Var MONTH: integer;

Begin

Write( ' ( 1 12): ' );

Readln(MONTH);

Case MONTH of

3,4,5:writeln('Beca');

6,7,8: writeln ('˳');

9,10,11:writeln('Oci');

12,1,2:writeln('a')

End;

End.

Dz ()

5. FOR

, . - , , .

():

* (For);

* (While);

* (Repeat).

, ( ). ³ :

) 1 :

For < >:= <1 > to <2 >do < >

ij : 1. -, 2, . ϳ 1 2 .. , 2, .

) -1 :

For < >:=< 1 > downto <2 > do <>

ij : 䳺 , 1.

- .

, 1 2 ( ). 1 2 - , , , .

1 2 to, ( ) v Succ(v), 1 2 downto, v Pred(v).

:

ϳ - - n.

':

program Stepin;

Var

a,p:real;

i,n:integer;

Begin

write(' a - , =');

readln(a);

write(' n - , n=');

readln(n);

p:=1;

for i:=1 to n do

p:= p * a;

writeln('p=',p)

End.

6. WHILE

For , . , , ( ) , Pascal : While Repeat.

:

 
 

 


ij :

( ) , . , . , , .

ҳ WHILE , True. ij, , . , .

 

 
 
1. . ) : programlatsimvol; var S:char; begin S:='A'; while S<='Z' do begin writeln(S); S:=succ(S); end end. ) : programlatsimvol; var S:char; begin S:='Z'; while S>='A' do begin writeln(S); S:=pred(S); end end.

 


 

 


7. REPEAT

 

For , . , , ( ) , Pascal : While Repeat.

:

 

 


() , .. ³ :

 

REPEAT <1 > <2 > <3 > *** < n > UNTIL <>;

ij : , . (), , , , .

ҳ Repeat , False. ij, , . , .

 

Ͳ : . : for i:=1 to 10 do for j:=1 to 15 do <>

:

Repeat Until KeyPressed ,

();

 

 
 
1. . ) : programlatsimvol; var S:char; begin S:='A'; Repeat write(S); S:=succ(S); until S>'Z' end. ) : programlatsimvol; var S:char; begin S:='Z'; Repeat write(S); S:=pred(S); until S<'A' end.


 


ϳ

ϳ . , . - -. ϳ : .

System, Crt, Dos, Graph .

ϳ , procedure function - .

1. (procedure). :

procedure <> (< >); < >; begin < > end;

. - ( : -) , - ( : -), . - var.

, array (. ).

.

1. Cina, k 0.6 . + 20% .

procedure Cina(k:integer; var c:real);

Begin

c:=k*0.6; c:=c+0.2*c;

End;

k -, -.

.

:

< > (< >);

, , . - , , , - . .

̳ . , .

: , , -, () .

, , . , . , , . .

-, . .

 

2. (function). , , .

:

function <>(< >): < >; < >; begin < , : :=> end;

. ( , sin, cos).

:

<> (< >).

1. tg(x) tg(x)+ctg(x)+tg2(x).

program Myfunc;

uses Crt;

var x,y:real;

function tg(x:real):real;

Begin

tg:=sin(x)/cos(x)

end;

begin clrscr;

writeln (' ');

readln (x);

y:=tg(x)+1/tg(x)+sqr(tg(x));

writeln ('y=', y:5:2); readln

End.

3. . , . , . .

, . .

1. a b :

function Suma(a,b:integer):integer;

Begin

if a=b then Suma:= a { - }

else Suma:= b + Suma(a, b1) { }

End;

 

2. i Factorial n! = 123...n, (0! = 1, 1! = 1), () i n! = n(n 1)!.

function Factorial(n: integer): integer;

Begin

if n = 0 then Factorial:= 1 { -}

else Factorial:= n * Factorial(n1)

End;

. , -, .


(array) () , .

a . (, , )- . , .

1. (, ):

:

TYPE < >=array [<>] of< >;

:

< >:array [<>] of< >;

( ) .

type, const, var. - .

. : 1) ( mymasyv), 2) c (-) vydatky mymasyv 3) - a, a1 mymasyv : b ( 7 ), c ( 100 -, char).

type mymasyv= array [1..10] of real;

day=(mon, tue, wed, the, fri, sat, sun);

const vydatky: mymasyv =(1.2, 1, 1, 2, 18, 2.4, 8.97, 3, 7, 1.3);

var a, a1: mymasyv;

b: array [day] of integer;

c: array [1..100] of char;

: a:=a1 a1 a. , , , , , .

. (



<== | ==>
 | , ()
:


: 2015-11-05; !; : 1684 |


:

:

, .
==> ...

1543 - | 1446 -


© 2015-2024 lektsii.org - -

: 0.424 .