Школа работы на IBM PC [часть 2]


304 71 1MB

Russian Pages 164 Year 1996

Report DMCA / Copyright

DOWNLOAD PDF FILE

Recommend Papers

Школа работы на IBM PC [часть 2]

  • 0 0 0
  • Like this paper and download? You can publish your own PDF file online for free in a few minutes! Sign Up
File loading please wait...
Citation preview

ɍȾɄ 681. 3 ɋɢɞɨɪɨɜ Ɇ. ȿ. , Ɍɪɭɲɢɧ Ɉ. ȼ. ɒɤɨɥɚ ɪɚɛɨɬɵ ɧɚ IBM PC. ɑɚɫɬɶ 2. ɍɮɚ, 1996.

ɫ.

ISBN

:

, IBM PC,

. Turbo-Pascal 7.0,

. -"

" .

"

,

, ")

("

. -

",

-"

. "

-

. ,

CRT

GRAPH.

"

"

. " "

", "

(

",

-

, "),

. ,

,

,

,

. , -

. Turbo-Pascal

"

"

,

Help, FoxPro.

FoxPro

.

.

. . . .

. 1.15, 2.1.1, 2.1.5, 2.3, 2.5 1.1 - 1.14, 2.1 - 2.2 2.4

3 . . .

. . .

. ., . .

. .

ɈȽɅȺȼɅȿɇɂȿ .

Ƚɥɚɜɚ 1. Ⱥɥɝɨɪɢɬɦɢɱɟɫɤɢɣ ɹɡɵɤ Ɍɭɪɛɨ-ɉɚɫɤɚɥɶ . . . . . . . . . . . . . . . 5 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1.

1. . . . . . . . . . . . . . . . . . . . . . . . . 5 2. ........................ 5 3. . . . . . . . . . . . . . . . . . . 8 4. . . . . . . . . . . . . . . . . . . . . . . . . . 9 5. . . . . . . . . . . . . . . . . . . . . . . . . 13 6. . . . . . . . . . . . . . . . . . . 14 7. . . . . . . . . . . . . . . . . . . . . . 17 7. 1. / . . . . . . . . . . . . . . . . 17 7. 2. . . . . . . . . . . . . . . . . . . . . . . . . . 21 7. 3. . . . . . . . . . . . . . . . . . . . . . . . . 22 7. 4. . . . . . . . . . .. . . . . . . . 27 7. 5. . . . . . . . . . . . . . . . . . . . 32 7. 6. . . . . . . . . . . 35 7. 7. . . . . . . . . . . . . . . . . . . . 36 8. . . . . . . . . . . . . . . . . . . . . . 37 9. . . . . . . . . . . . . . . . . . 39 10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . 40 10. 1. . . . . . . . . . . . . . . . . . . . . . . .. . . 40 10. 2. . . . . . .. . . 44 10. 3. . . . . . . . . . . . . . . . . . . . . . .. . . 45 10. 4. . . . . 48 10. 5. . . . . . . . . . . . . . . . . .. . . 49 11. . . . . . . . . . . . . . . . . . . . . . . . . .. . . 50 12. . . . . . . . . . . . . . . . . .. . . 55 12. 1. . . . . . . . . . . . . . . . . . . 55 12. 2. . . . . . . . . . . . . . . . . 60 13. . . . . . . . . . . . . . . . . . . . . . . . . . 64 14. CRT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 14. 1. . . . . . . . . . . . . . 67 14. 2. . . . . . . . . . . . . . . . . . . .. . . 68 14. 3. . . . . . . . . . . . . . . . 73 14. 4. . . . . . . . . . . . . . . . . 76 14. 5. . . . . . . . . . . . . . . . . . 77 15. Graph. . . . . . . . . . . . . . . . . . . . . . . . . . .. . . 79 15. 1. . . . . . . . . . . . . . . 79 15. 2. . . . . . . . . 80 15. 3. . . . . . . . . . . . . . . . . 88 15. 3. 1. . . . . . . . . . . . . . . . 88 15. 3. 2. . . . . . . . . . . . . . . . . . . . . . . . 91 15. 3. 3. . . . . . . . . . . . . . . . . . . . . 94 15. 4. . . . . . . . . . . . . . . . . 102 .

1. 15. 5. 1. 15. 5. 1.

. . . . . . . . . . . . . . . . . . . . . . . . . 104 . . . . . .. . . 104

1. 15. 5. 2. 1. 15. 5. 3. 1. 15. 5. 4.

. . . . . .. . . 107 . . . . . . . 108 . . . . . . . . . . . . 109

Ƚɥɚɜɚ 2. ɉɪɨɝɪɚɦɦɢɪɨɜɚɧɢɟ ɜ ɫɪɟɞɟ Ɍɭɪɛɨ-ɉɚɫɤɚɥɶ. . . . . . . . .. 111 2. 1. 2. 1. 1. 2. 1. 2. 2. 1. 3. 2. 1. 4. 2. 1. 5. 2. 1. 6. 2. 2. 2. 2. 1. 2. 2. 2. 2. 2. 3. 2. 3. 2. 4. 2. 5. 2. 5. 1. 2. 5. 2. 2. 5. 3. 2. 5. 4.

. . . . . . . . . . . . . . 111 . . . . . . . . . . . . . . . . . . 111 . . . . . . . . . . . . . . . . . 118 . . . . . . . . . . . . 118 . . . . 119 . . . . . . . . . . . . . . 121 . . 126 . . . . . . . . . . . . . . . . . . . . . . . . . 128 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 . . . . . . . . . . . . . . . . . 138 . . . . . . . . 140 . . 147 . . . . . . . . . . . . . . . . . 150 . . . . . . . . . . . . . . . . . . . . 150 . . . . . . . . . 152 . . . . . . . . . . . . . . . . . 153 . . . . . . . . . . . . . . 156

Ƚɥɚɜɚ 1. Ⱥɥɝɨɪɢɬɦɢɱɟɫɤɢɣ ɹɡɵɤ Ɍɭɪɛɨ-ɉɚɫɤɚɥɶ 1. 1. Ɉɛɳɢɟ ɫɜɟɞɟɧɢɹ

1969-71 . International (

,

Borland

, ,

) )

-

( (Turbo-Pascal)

.

, ɚɥɝɨɪɢɬɦɚ - ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɫɬɢ ɨɩɟɪɚɰɢɣ, ɨɩɢɫɵɜɚɸɳɢɯ ɩɪɨɰɟɫɫ ɪɟɲɟɧɢɹ ɡɚɞɚɱɢ. ɛɥɨɤ-ɫɯɟɦɵ. . , . ( , . . ). , . ɉɪɨɝɪɚɦɦɢɪɨɜɚɧɢɟ ɡɚɤɥɸɱɚɟɬɫɹ ɜ ɡɚɩɢɫɢ ɚɥɝɨɪɢɬɦɚ ɧɚ ɹɡɵɤɟ ɩɪɨɝɪɚɦɦɢɪɨɜɚɧɢɹ ɢ ɨɬɥɚɞɤɟ ɩɪɨɝɪɚɦɦɵ. , -

(

-

)

-

.

: (

-

), (

,

,

), (

-

),

,

,

,

-

, .

1. 2. ɋɪɟɞɚ Ɍɭɪɛɨ-ɉɚɫɤɚɥɶ Ⱦɥɹ ɡɚɝɪɭɡɤɢ

turbo. exe.

-

Ɇɟɧɸ ɚɤɬɢɜɢɡɢɪɭɟɬɫɹ

).

F10. .

Enter.

"..."

( Tab, (

: Shift+Tab). Tab Shift+Tab. SpeaceBar. -

(*) [X] ,

-

7. 0. 5

File

-

New Open

F3

ɪɚɛɨɬɚ ɫ ɮɚɣɥɚɦɢ.

- ɫɨɡɞɚɬɶ ɧɨɜɵɣ ɮɚɣɥ. ( NONAME00. PAS ) F2 - ɨɬɤɪɵɬɶ (ɫɨɡɞɚɬɶ) ɮɚɣɥ "Name" Enter, , . - ɫɨɯɪɚɧɢɬɶ ɮɚɣɥ ( ); - ɫɨɯɪɚɧɢɬɶ ɮɚɣɥ ɩɨɞ ɧɨɜɵɦ ɢɦɟɧɟɦ ( - ɫɨɯɪɚɧɢɬɶ ɜɫɟ ɮɚɣɥɵ ;

. . Tab

Save F2 Save as... Save all ............ Exit ALT+X - ɜɵɯɨɞ ɢɡ ɫɪɟɞɵ Ɍɭɪɛɨ-ɉɚɫɤɚɥɶ;

Enter, ". . \ "; );

ɋɩɢɫɨɤ ɢɦɟɧ ɮɚɣɥɨɜ ɞɥɹ ɪɟɞɚɤɬɢɪɨɜɚɧɢɹ -

Enter, Esc. .PAS. -

. .

.

- ɪɚɛɨɬɚ ɫ ɨɤɧɚɦɢ.

Window

ɩɚɪɚɥɥɟɥɶɧɨɟ ɪɚɡɦɟɳɟɧɢɟ ɨɤɨɧ ; ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɨɟ ɪɚɡɦɟɳɟɧɢɟ ɨɤɨɧ ; ɡɚɤɪɵɬɶ ɜɫɟ ɨɤɧɚ ; ɨɛɧɨɜɢɬɶ ( ) ; ɢɡɦɟɧɟɧɢɟ ɪɚɡɦɟɪɨɜ ɨɤɧɚ Shift+ ; ɩɟɪɟɦɟɳɟɧɢɟ ɚɤɬɢɜɧɨɝɨ ɨɤɧɚ ; ɪɚɫɩɚɯɧɭɬɶ ɨɤɧɨ ɜɨ ɜɟɫɶ ɷɤɪɚɧ, F5 ; ɩɨɫɥɟɞɨɜɚɬɟɥɶɧɚɹ ɫɦɟɧɚ ɚɤɬɢɜɧɨɝɨ ɨɤɧɚ; ɫɦɟɧɚ ɚɤɬɢɜɧɨɝɨ ɨɤɧɚ ɜ ɨɛɪɚɬɧɨɦ ɧɚɩɪɚɜɥɟɧɢɢ; ɡɚɤɪɵɬɶ ɚɤɬɢɜɧɨɟ ɨɤɧɨ; ɩɨɤɚɡɚɬɶ ɫɩɢɫɨɤ ɨɤɨɧ. Enter. Size, Move Enter. , .

Tile Cascade Close all Refresh display Size Ctrl+F5 Move Ctrl+F5 Zoom F5 Next F6 Previous Shift+F6 Close Alt+F3 List Alt+0

- ɪɟɞɚɤɬɢɪɨɜɚɧ

Edit

Undo Alt+BkSp Redo Cut Shift+Del Copy Ctrl+Ins Paste Shift+Ins Clear Ctrl+Del Show Clipboard

6

-

B K C V Y R W H F A

1

).

- ɨɬɦɟɧɢɬɶ ɩɪɟɞɵɞɭɳɭɸ ɤɨɦɚɧɞɭ ; - ɜɨɫɫɬɚɧɨɜɢɬɶ ɨɬɦɟɧɟɧɧɭɸ ɤɨɦɚɧɞɭ ; - ɭɞɚɥɢɬɶ ɛɥɨɤ ɫ ɷɤɪɚɧɚ ɜ ɛɭɮɟɪ ( Clipboard); - ɫɤɨɩɢɪɨɜɚɬɶ ɛɥɨɤ ɫ ɷɤɪɚɧɚ ɜ ɛɭɮɟɪ; - ɢɡɜɥɟɱɶ (ɫɤɨɩɢɪɨɜɚɬɶ) ɛɥɨɤ ɢɡ ɛɭɮɟɪɚ ɧɚ ɷɤɪɚɧ; - ɭɞɚɥɢɬɶ ɛɥɨɤ ; - ɩɨɤɚɡɚɬɶ ɨɤɧɨ ɛɭɮɟɪɚ.

Ⱦɥɹ ɜɵɞɟɥɟɧɢɹ ɛɥɨɤɚ 5. 0 : Ctrl+K Ctrl+K Ctrl+K Ctrl+K Ctrl+K Ctrl+K Ctrl+K Ctrl+K Ctrl+Y Ctrl+Q Ctrl+Q

(

- Shift+ɤɭɪɫɨɪɧɵɟ ɤɥɚɜɢɲɢ.

- ɧɚɱɚɬɶ ɜɵɞɟɥɟɧɢɟ ɛɥɨɤɚ - ɡɚɤɨɧɱɢɬɶ ɜɵɞɟɥɟɧɢɟ ɛɥɨɤɚ - ɫɤɨɩɢɪɨɜɚɬɶ ɛɥɨɤ; - ɩɟɪɟɦɟɫɬɢɬɶ ɛɥɨɤ - ɭɞɚɥɢɬɶ ɛɥɨɤ; - ɩɪɨɱɢɬɚɬɶ ɛɥɨɤ ɫ ɞɢɫɤɚ; - ɡɚɩɢɫɚɬɶ ɛɥɨɤ ɧɚ ɞɢɫɤ; - ɭɛɪɚɬɶ ɜɵɞɟɥɟɧɢɟ ɛɥɨɤɚ; - ɭɞɚɥɢɬɶ ɫɬɪɨɤɭ. - ɩɨɢɫɤ ɫɢɦɜɨɥɨɜ; - ɩɨɢɫɤ ɢ ɡɚɦɟɧɚ ɫɢɦɜɨɥɨɜ.

ɩɨ ɬɟɤɫɬɭ ( Forward ), ɜɜɟɪɯ ɩɨ ɬɟɤɫɬɭ ( Backward ). [X] Prompt on replace - ɩɨɞɬɜɟɪɠɞɟɧɢɟ .

-

; ; ;

: ɜɧɢɡ

.

Enter

.

.

Del

Ins

BackSpace /

-

. ɋɩɪɚɜɨɱɧɚɹ ɢɧɮɨɪɦɚɰɢɹ , Alt+F10 ɥɨɤɚɥɶɧɨɟ ɦɟɧɸ, .

: Ctrl+F1 ( Help. -

F1, ), Shift+F1 ( ),

Save -

,

( F2 ), Exit ( Alt+X )

: Save?

( Alt+F9

). Ⱦɥɹ ɤɨɦɩɢɥɹɰɢɢ ɩɪɨɝɪɚɦɦɵ Compile ɦɟɧɸ Compile. ( ), Compile: Make (F9) .

Build ,

: Error 85 ";" expected , -

, (

";").

-

,

, .

.

( Directories.

Disk)

,

( .ȿXE) Memory ɜ ɦɟɧɸ Compile, Destination EXE & TPU directory Options, . TPU. 7 .

Options, Environment, Preferences [X] Editor files , Options, Environment, Editor [X] Create backup files . BAK) . [X] Persistant blocks Options, Directories EXE & TPU directory - C:\tp7\exe ( Include directories - C:\tp7\inc ( Unit directories - C:\tp7\unit (

:

: ( . : . exe

. tpu ), {$I} ), *. tpu ).

Save ɦɟɧɸ Options.

-

Run ɦɟɧɸ Run (Ctrl+F9) ɡɚɩɭɫɤɚɟɬ ɢɫɩɨɥɧɹɟɦɵɣ ɮɚɣɥ , , . , , , , / . , , Runtime error 200: Division by zero at 0BEC:0045 ( ). Ctrl+Break. . Alt+F5.

1. 3. ɋɬɪɭɤɬɭɪɚ ɹɡɵɤɚ Ɍɭɪɛɨ-ɉɚɫɤɚɥɶ Ⱥɥɮɚɜɢɬ ɹɡɵɤɚ ( ) : a z A Z, : 0 9, : _ + - * / = , . : ; < > ( ) [ ] { } ^ @ $ #, “_” #0 #31. ( ) , : absolute, and, array, begin, case, const, constructor, destructor, div, do, downto, else, end, external, file, for, forward, function, goto, if, implementation, in, inline, interface, interrupt, label, mod, nil, not, object, of, or, packed, procedure, program, record, repeat, set, shl, shr, string, then, to, type, unit, until, uses, var, vertual, while, with, xor . : ɤɨɧɫɬɚɧɬɵ , ɩɟɪɟɦɟɧɧɵɟ , ɜɵɪɚɠɟɧɢɹ , ; ɨɩɟɪɚɬɨɪɵ ɮɭɧɤɰɢɢ, ɩɪɨɰɟɞɭɪɵ ɢ ɦɨɞɭɥɢ .

; ; , ,

; ,

8

Ⱦɥɹ ɨɛɨɡɧɚɱɟɧɢɹ ɢɦɟɧ , , , , ɱɢɧɚɸɬɫɹ ɫ ɛɭɤɜɵ ɢɥɢ ɡɧɚɤɚ ɩɨɞɱɟɪɤɢɜɚɧɢɹ " _ " .

,

" _ ". ɂɦɟɧɚ ɧɚ63 . ɢɞɟɧɬɢɮɢɤɚɬɨɪɚɦɢ. -

. . ɋɩɟɰɢɚɥɶɧɵɟ ɡɧɚɤɢ:

: Alfa, C, X_max, Y_min, Sin, Cos, _10_A. ɉɪɢɦɟɪɵ:

:= = ; :

-

,

,

( x:= 0. 1; c:= Cos(x); d:= c; ), ( Const n= 1; m= 200; ), ( Type M = array [N. . M] of integer; ), ( b:= 5; goto M1; begin end; ), ( Var b, c, d: real; i, j, k: integer; ),

, .. () -

, ,

[] {} ' # $ @ ^

( M1: c:=sin(x); ), ( Uses CRT, DOS; ), ( a: array [1. . 100] of real; ), ( y:= b/(c+d) ; ), ( y:=Sin(x); ), ( a[1]:=22; ), } ), ( :='!';S:='C '; ), ASCII ( c:=#33; ), ( i:=$FF; ), ( yx:=@x; ) "x" }, ( Var yx: ^real; ), ( yx^ := 0. 1; ),

. .

,

-

( {

{ yx ,

-

,

+ - / * = > < = -

.

1. 4. Ɍɢɩɵ ɩɟɪɟɦɟɧɧɵɯ ,

,

:

,

. .

9 ,

, : TYPE A = array [ 1 . . 1000 ] of real ; VAR,

VAR a1, a2: A; {

:

1000

"A" } TYPE,

:

VAR a1, a2 : array [ 1 . . 1000 ] of real ;

. ȼɟɳɟɫɬɜɟɧɧɵɟ ɬɢɩɵ

:

. (

VAR

)

Single Real Double Extended Comp

7..8 10 (-45..+38) 11..12 10 (-39..+38) 15..16 10 (-324..+308) 19..20 10 (-4951..+4932) 19..20 -263 +1..+263 -1

4 6 8 10 8

ɉɪɢɦɟɱɚɧɢɟ:

c, d, e: real; d1, d2: double;

: ɫ:= -125. 6; e:= 10; d:= 1. e02; { } d:= 100.; d1:= 1.2e-257; { 1.2*10-257} Comp .

Single, Double, Extended . Options, Compiler Numeric processing: [X] 8087/80287, [X] Emulation, {$N+}. ɉɨɪɹɞɤɨɜɵɟ ɬɢɩɵ

, -

.

ɐɟɥɵɟ ɬɢɩɵ ( Byte Shortint Word Integer Longint

: i, j, k: byte; h, m, n: integer; l1, l2, l3: longint;

) 1 1 2 2 4

VAR 0..255 -121..+127 0..65535 -32761..+32767 -2147483641.. +2147483647

: i:= 222; j:= 10; m:= -23000; l1:= 280000; h:= $A7; ( 10*16+7)

Ʌɨɝɢɱɟɫɤɢɣ ɬɢɩ : False ( :

b1:= True;

10

)

True (

).

VAR

b1, b2, b3, b4: boolean; : b2:= False; b3:= not b1; { } b3:= False; b4:= b1;

ɋɢɦɜɨɥɶɧɵɣ ɬɢɩ #0

#255,

. . #0

. #31 (

) .

: VAR

, ch, e: char; :

,

-

{

c:= '!'; c:= #33; ch:= #13; {

Enter } Write(ɫ);

:

"!"

} {

e:= #27;

Esc } "!"} } #27 }

{ {

Write(ch); Write(ɟ);

{

,

ɋɬɪɨɤɨɜɵɣ ɬɢɩ :

VAR

{

, s1: string;

s: string[25]; { s s1 , :

s:= 'ɉɪɢɜɟɬ';

. 1

25

} 255 }

s1:= 'Hello';

Ɇɚɫɫɢɜ Ɇɚɫɫɢɜ - ɭɩɨɪɹɞɨɱɟɧɧɵɟ ɞɚɧɧɵɟ ɨɞɧɨɝɨ ɬɢɩɚ, ). ,

(

( .

)

( ).

(

),

65520

.

-

: VAR

M1: array[1..200] of integer; ch1: array['A'..'Z'] of char; {

A1: array[100..200] of real; ch2: array[0..255] of char;

1, A1 -

} }

{ h1, ch2 : M1[1]:=5; A1[101]:=0.2;

M1[2]:=8; A1[102]:=2.31;

M1[3]:= M1[1]; ch1['B']:='C';

M1[100]:=32; ch2[1]:='!'

Ɍɢɩ-ɞɢɚɩɚɡɨɧ ɢ ɩɟɪɟɱɢɫɥɢɦɵɣ ɬɢɩ . TYPE Date_M= 1..31; Rush_b= ' .. '; Lat_b= 'A..Z'; { Otmetka= (2,3,4,5); Ball= (1,2,3,4,5,6,7,8,9,10); { VAR

t1,t2:Date_M;

: } }

c1:Ruch_b; s1:Lat_b; a1,a2:Otmetka; b:Ball; : t1:= 10; c1:= 'Ʌ'; s1:= 'F'; a1:=5; b:= 8;

11

Ɏɚɣɥɵ Ɏɚɣɥ - ɢɦɟɧɨɜɚɧɧɚɹ ɨɛɥɚɫɬɶ ɜɧɟɲɧɟɣ ɩɚɦɹɬɢ

, .

.

, , .

:

VAR

f1,

f2: text;

. -

: Assign( f1, 'file1. in' ); Assign( f2, 'C:\ PASCAL\ WORK\ file2. out' ); Assign file1. in

. .

file2. out

DOS. Ɂɚɩɢɫɢ ,

,

,

Record ɢ End.

-

: Type

Var

Sity = Record Name_G: String[20]; Numb_G: LongInt; Stol_G: Boolean; Shir, Dol: Real { End; St1, St2, St3: Sity; { :

St1. Name_G:= 'ɍɮɚ'; St1. Numb_G:=1200000; { St2. Name_G:= 'Ɇɨɫɤɜɚ'; St2. Numb_G:=8200000; St3:= St1; WITH

"

"

DO

{

} {

{ :

} ( ,

,

)} } }

St1 } {

St3 } :

"

";

: With St1 do Begin Name_G:= 'ɍɮɚ'; Stol_g:= True; Readln(Shir, Dol); z:= Numb_G - St2. Numb_G; Writeln(Name_G:5, Numb_G:10) end; ɉɪɚɤɬɢɱɟɫɤɨɟ ɡɚɞɚɧɢɟ N 1. 1 1)

f1. pas, f2. pas, File_1. pas. , f1. pas f2. pas. . File_1. pas f1. pas

f1. pas.

f1. pas

12

. f2. pas

File_1. pas. f2. pas.

1. 5. ɋɬɪɭɤɬɭɪɚ ɩɪɨɝɪɚɦɦɵ -

:

{

Program NAME;

{$N+}

{ NAME -

{ Ɋɚɡɞɟɥ ɨɩɢɫɚɧɢɹ } {

CRT, DOS, GRAPH }

{

Label L1, L2, L3; Const C=10; B=0. 15; Y=True; F='Ɏɚɦɢɥɢɹ';

} {

Uses CRT, DOS, GRAPH;

L1, L2, L3 }

{

, { { Y-

Type M= array[1. . 100] of integer;

} }

} , , F-

{

} } }

Var { } m1, m2: M; { m1, m2 ( )} a1: array [ 1. . 100 ] of real; { 1} ch: array [ 1. . 200 ] of char; { ch } ch1, ch2: char; { ch1, ch2 } s: string[79]; {s79 } a, d, x: real; { a, d, x } yes, no: boolean; { yes, no } f1, f2: text; { } { ---------------------------------------------------------------- } Procedure NAME_1(Parm1:Real; Var Parm2:Real); { } { NME_1 , Parm1, Parm2 } { Ɋɚɡɞɟɥ ɨɩɢɫɚɧɢɹ } BEGIN { Ɋɚɡɞɟɥ ɜɵɩɨɥɧɟɧɢɹ } END; { ---------------------------------------------------------------- } Function FUN_1(Parm3, Parm4: Real): Real; { } { FUN_1 , Parm3, Parm4 } { Ɋɚɡɞɟɥ ɨɩɢɫɚɧɢɹ } BEGIN { Ɋɚɡɞɟɥ ɜɵɩɨɥɧɟɧɢɹ } END; { ---------------------------------------------------------------- } { $I File_1. pas } { File_1. pas } { ---------------------------------------------------------------- } BEGIN { } { Ɋɚɡɞɟɥ ɜɵɩɨɥɧɟɧɢɹ } END. { }

1. 6. Ɉɩɟɪɚɰɢɢ ɢ ɫɬɚɧɞɚɪɬɧɵɟ ɮɭɧɤɰɢɢ

13

ɭɫɥɨɜɧɵɟ ɡɧɚɤɢ ɢ ɫɥɭɠɟɛɧɵɟ ɫɥɨɜɚ ɞɥɹ

ɨɩɢɫɚɧɢɹ ɪɚɡɥɢɱɧɵɯ ɨɩɟɪɚɰɢɣ:

ɅɈȽɂɑȿɋɄɂȿ ɈɉȿɊȺɐɂɂ not

1

not A " "

and

2

A and B " "

or

3

A or B

or

3

A

"

"

"

"

or B

ɆȺɌȿɆȺɌɂɑȿɋɄɂȿ ɈɉȿɊȺɐɂ X * Y X / Y

2 2

/

2 2

div mod

N div M N mod M

3 3

+ -

X + Y X - Y

*

4 4 4 4 4

=

> < >=

X X X X X

= Y Y > Y < Y >= Y

4

S2; { ɢ ɬ. ɞ. } Write('s1:=', s1, ' _ _ s2:=', s2); Writeln(' _ _ Zb:= s1 > s2;', ' _ _ zb=', zb); Writeln; readln; {

{ Enter }

Writeln('Ɇɚɬɟɦɚɬɢɱɟɫɤɢɟ ɮɭɧɤɰɢɢ:'); Z:= sin(x*Pi/180); Write('x:=', x:4:2); Writeln(' _ _ Z:= sin(x*Pi/180);', ' _ _ z=', z:10:7); Writeln; readln; { Writeln('Ɇɚɬɟɦɚɬɢɱɟɫɤɢɟ ɩɪɨɰɟɞɭɪɵ:'); Write('x1:=', x1); Inc(x1); Writeln(' _ _ Inc(x1);', ' _ _ x1=', x1); Writeln; readln; Writeln('Ɏɭɧɤɰɢɢ ɩɪɟɨɛɪɚɡɨɜɚɧɢɹ ɬɢɩɨɜ:'); } Write('x0:=', x0); Writeln(' _ _ c3:=Chr(x0);', ' _ _ c3=', c3); readln end.

}

{

{

. . }

} Enter }

{ {

. . } } Enter }

{

{

c3:= Chr(x0);

{

. .

Enter }

,

-

. ɉɪɚɤɬɢɱɟɫɤɨɟ ɡɚɞɚɧɢɟ N 1. 2 1) . 2)

.

Ɉɩɟɪɚɬɨɪɵ ɜɜɨɞɚ Readln(" ");

ɞɚɧɧɵɯ

ɫ

ɤɥɚɜɢɚɬɭɪɵ

Read("

");

" "-

. -

. , : Write('ɜɜɟɞɢɬɟ ɡɧɚɱɟɧɢɟ ɚ='); Readln(a); : ɜɜɟɞɢɬɟ ɡɧɚɱɟɧɢɟ ɚ= . Readln(a); . " ", , Enter. Ⱦɥɹ ɜɜɨɞɚ ɡɧɚɱɟɧɢɣ ɧɟɫɤɨɥɶɤɢɯ ɩɟɪɟɦɟɧɧɵɯ, , a, b, c : Readln(a); Readln(b); Readln(c); ɢɥɢ Readln(a, b, c); ɉɪɢ ɜɜɨɞɟ ɧɟɫɤɨɥɶɤɢɯ ɱɢɫɥɨɜɵɯ ɞɚɧɧɵɯ, , Readln(a, b, c); SpaceBar Enter, - Enter.

ɉɪɢ ɜɜɨɞɟ ɡɧɚɱɟɧɢɣ ɫɢɦɜɨɥɶɧɵɯ ɩɟɪɟɦɟɧɧɵɯ

y=xn.

-

n*ln(x)

”n”,

.

{

}

'; '); x Readln(x); Readln(n);

>0'); n='); y=', y:-10:6);

n');

writeln(' Enter}

Enter'); Ba

b

ɉɪɚɤɬɢɱɟɫɤɨɟ ɡɚɞɚɧɢɟ N 1. 3 1. S = √(p*(p-a)*(p-b)*(p-c)), a, b, c 2. , Ha= 2*S/a , Ma= √(2*b2 + 2*c2 - a2)/2 -

-

-

: y=e

Program N_2; Const S=' Var n, x, y: real; BEGIN Writeln(' Writeln(' Writeln(S, ' Write(S, ' y:=exp(n*ln(x)); Writeln(' readln; { END.

-

: "ɍ", "Ɋ", "Ⱥ", "!" : ɍɊȺ!

“x” . .

-

19 -

Enter Enter (#13), Enter SpaceBar (#32).

, : Readln(ɫ1, ɫ2, ɫ3, c4); ɫ1, ɫ2, ɫ3, c4, . . , Enter. Writeln(ɫ1, ɫ2, ɫ3, c4); Readln; Enter, . . . Readln, Read (#13), .

-

Ma

Ha

c

: p=(a+b+c)/2 (

.

a

).

: "a", ,

Hb, Hc; Mb, Mc;

Ba= 2* √(b*c*p*(p-a) )/(b+c) a, b, c . 3.

,

Bb, Bc;

(

). S -

, R2= a*b*c/(4*S), S. a, b, c ( 4. "S" N : S= (A1 + AN)*N/2. A1, AN, N 5. "S" N BN : S= (B1 - BN*Q)/(1-Q). BN =B1 *QN. B1, Q ɉɪɢɦɟɱɚɧɢɟ: .

, p-

-

R1= S/p , p-

-

). A1, A2, . . . ,

AN

B1, B2, . . . , . .

20

1. 7. 2. ( "

".

:

Case " " Else "

" "" ɡɧɚɱɟɧɢɟ "ɩɚɪɚɦɟɬɪɚ", . ,

" Of " " End;

. " ɜɵɩɨɥɧɹɟɬɫɹ ɨɩɟɪɚɬɨɪ ɫ ɦɟɬɤɨɣ, ɜɤɥɸɱɚɸɳɟɣ Else. Else " "

:

"ɨɩɟɪɚɬɨɪ"

Begin

"

N case N of 0..9: writeln(' 10..99: writeln(' 100..999: writeln(' else writeln('

),

"

0

end;

999:

'); '); ') "N"

')

end; -

1/20, PROGRAM FUTURE; var N: word; Begin writeln(' Randomize; N:=Random(20)+1; writeln; write('

-

"

".

'); {N_');

1

20 }

case N of 1: writeln(' 2: writeln(' 3: writeln(' 4: writeln(' 5: writeln(' else writeln(' writeln(' END.

'); '); '); '); '); ') Enter');

6: 7: 8: 9: 10: end; readln;

writeln(' writeln(' writeln(' writeln(' writeln('

'); '); '); '); ')

,

Random(x)

-

. Randomize.

21

ɉɪɚɤɬɢɱɟɫɤɨɟ ɡɚɞɚɧɢɟ N 1. 4 1.

10

1/15,

-

. 2.

10

,

1/30 ,

.

3. ),

: 1. . 2:

, 3. . 5:

( . .,

,

-

. 4. ( -50 -19. . -10:

+50 0 ,

), . .,

: -50. . -20: -

, .

1. 7. 3. ɍɫɥɨɜɧɵɣ ɨɩɟɪɚɬɨɪ ,

.

IF

" " "

"

"1" 2"

"

Then

"

1"

: Else

"

2";

; , ,

( True ), ( False ).

, "a" a>=0, : IF a >= 0 Then b:= Sqrt(a) Else begin WriteLn ( 'a=0');

-

:

Readln(x);

If x 2*S1 Then Goto Writeln(S);

:

M1

" " ("a"

end;

" "

-

"b")

. PROGRAM del; label M1, M2, M3; var b, a: longint; Begin M3:

Writeln(' '); readln(a, b); Writeln; if (a b then a:= a mod b else b:= b mod a; if (a= 0) or (b= 0) then Writeln(' =',a+b) else goto M2; Writeln(' Enter'); readln; end. 36

1. 8. Ȼɥɨɤ - ɫɯɟɦɵ ɚɥɝɨɪɢɬɦɨɜ

-

. .

,

-

.

-

,

,

. N ∈ i1, i2, ..., ik Ɉɩɟɪɚɬɨɪ ɜɵɛɨɪɚ:

ɧɟɬ

ɞɚ

N: ɨɩɟɪɚɬɨɪ ɫ ɦɟɬɤɨɣ N

Ɉɩɟɪɚɬɨɪ

ɉɪɨɜɟɪɤɚ ɭɫɥɨɜɢɹ ɍɫɥɨɜɧɵɣ ɨɩɟɪɚɬɨɪ:

ɞɚ

ɨɩɟɪɚɬɨɪ 1

ɧɟɬ ɨɩɟɪɚɬɨɪ 2

ɞɚ i:= N1

i > N2

Ɉɩɟɪɚɬɨɪ ɰɢɤɥɚ ɫ ɩɚɪɚɦɟɬɪɨɦ: (ɡɧɚɱɟɧɢɟ ɩɚɪɚɦɟɬɪɚ ɜɨɡɪɚɫɬɚɟɬ)

ɧɟɬ i:=i+1

ɨɩɟɪɚɬɨɪ

37 Ɉɩɟɪɚɬɨɪ ɰɢɤɥɚ ɫ ɩɨɫɬɭɫɥɨɜɢɟɦ: ɨɩɟɪɚɬɨɪɵ

ɉɪɨɜɟɪɤɚ

ɞɚ

ɭɫɥɨɜɢɹ ɧɟɬ

Ɉɩɟɪɚɬɨɪ ɰɢɤɥɚ ɫ ɩɪɟɞɭɫɥɨɜɢɟɦ:

ɉɪɨɜɟɪɤɚ ɭɫɥɨɜɢɹ

ɧɟɬ

ɞɚ ɨɩɟɪɚɬɨɪ :

,

,

,

. -

S1

S2

N

-100

100.

Begin

N

Randomize; S1:=0; S2:=0;

i:=1;

ɞɚ

i>N

S1, S2

End.

ɧɟɬ i:= i + 1;

x:= Random(201) - 100; ɞɚ S2:= S2 + x;

ɧɟɬ x a[k]} M[j]:= i end;

41 ɉɪɚɤɬɢɱɟɫɤɨɟ ɡɚɞɚɧɢɟ N 1. 18 1.

"

"

10

"

"

.

-

, Random. 2.

. ,

.

,

-

: ,

. ɉɪɚɤɬɢɱɟɫɤɨɟ ɡɚɞɚɧɢɟ N 1. 19 1. =< x