Вы находитесь на странице: 1из 336

"^

2-

Begining
Programming
FOR
2nd edition

by Wallace Wang

Hungry Minds
HUNGRY MINDS, INC.

New York, NY * Cleveland,OH * Indianapolis,IN


Chicago, IL * Foster City, CA * San Francisco,CA

""2-

* - *
2002

32.973.26-018.2.75
76
681.3.07
""
. .

"" :
info@dialektika.com, http://www.dialektika.com

, .
76

"".: . . .:
"", 2002. 336 . : . . . .
ISBN 5-8459-0197-9 (.)
, . ,
. ,
, .
BASIC, ,
Internet.
.

.
32.973.26-018.2.75

.

, , , Hungry
Minds, Inc.
Copyright 2001 by Dialekiika Computer Publishing.
Original English language edition copyright 2001 by Hungry Minds, Inc.
All rights reserved including the right of reproduction in whole or in part in any form.
This edition published by arrangement with the original publisher, Hungry Minds, Inc.
Windows is a trademark of Microsoft Corporation. ...For Dummies, Dummies Man logos are trademarks under
exclusive license to Hungry Minds, Inc. Used by permission.

ISBN 5-8459-0197-9 (.)


ISBN 0-7645-0835-0 (.)

- "", 2001
Hungry Minds, Inc., 2001


I.

21

1.
2. -
3.
4.

23
28
41
54

II. LIBERTY BASIC

65

5. : Liberty BASIC
6.
7. ,
8.
9.
10.

67
74
80
91
104
120

III.
LIBERTY BASIC

127

129
143
153
164
183

11.
12.
13.
14.
15.

IV.

189

16.
17.
18,
19.

191
199
204
217

V. : ,

229

20.
21.
22.

231
246
255

VI. INTERNET

263

23. HTML
24. Web- JavaScript
25. Java- Web-
26. Python

265
286
296
302

VII.

313

27.
28.

323
333

I.

21

1.



;

2, -




RAD

.
Web-
?
3.




;







4.

-:
?
""

23
23
24
25
26
27
2

II. LIBERTY BASIC

65

5. : Liberty BASIC
Liberty BASIC
Liberty BASIC ()
Liberty BASIC
Liberty BASIC Windows

67
67
67
68
68

41
41
42
43
44
44
44
50
51
52
52
53
54
55
56
56
57
58
59
59
60
62

Liberty BASIC
Liberty BASIC
Liberty BASIC
Liberty BASIC
, Liberty BASIC
, Liberty BASIC

Liberty BASIC
Liberty BASIC
6.
-:
-;



7. ,





8.
, ,



Liberty BASIC



Liberty BASIC






( )
9.



IF THEN
IFTHENELSE
IF THEN ELSE IF
Select Case


10.
WHILE WEND
N1:
N2:
FOR NEXT

68
69
70
70
71
72
72
73
73
74
74
77
77
77
78
80
80
81
85
88
89
91
91
92
93
94
95
96
96
97
98
98
99
100
100
100
101
102
104
104
106
107
111
112
113
. 114
116
117
120
121
122
123
124

III.
LIBERTY BASIC
11.















12.

""







13.












14.







125

127
129
129
131
131

140
140
140
141
143
144
147
148
148
149
150
151
151
153
153
154
155
155
157
157
159
160
161
162
162
164
164
164
165
167
167
170
171
172








15.



174
175
176
177
178
180
181
183
183
183
185
186

IV.
16.

189
191


( )


17.





18.






19. -







-

191
193
194
197
199
200
201
201
201
202
204
204
206
208
209
211
211
212
212
213
214
215
217
217
218
220
221
222
223
224
225

V. : ,

229

20.

231
235




21.


-

22.





FOR NEXT




242
244
246
246
248
250
251
252
254
255
256
256
257
257
258
259
260
261
261
262

VI. INTERNET

263

23. HTML
HTML
HTML

Web-

















Web-

Web-




265
265
267
267
267
268
268
268
269
270
270
271
272
272
273
273
273
274
275
276
276
277
277
278
278
278
279
280
280
281

10



HTML
24. Web- JavaScript
JavaScript







282
283
285
286

25. Java- Web-

296

Java-
Java- Web-
Java-
Java-
Java-
Java-
26. Python
Python



while
for
Python

296
299
299
299
300
300
302
302
303
305
307
307
309
309

VII.

313

27.


Internet





28.

Windows
Macintosh Palm OS
Linux
-
BASIC
C/C-i- Java
Pascal

315

288
289
291
293
293
294
294

310

316
319
320
321
323

328

11


KnowledgePro
Clarion
PowerBuilder


Usenet

12

330
330
330
330
331
333


,
,
. , , -
, , , .

IBM PC, .
MS DOS 1.25,
,
,
- .
,
, .
, .
,
. .


,
:
( ), ( ), , ,
( ).
(Lily Carnie), , .
, Riviera Comedy Club (-).
(Steve Schirripa), (Don Learned), (Bob Zany),
(Gerry Bednob), Beracy (Bruce Vegas).
- (Patrick DeGuire), -. (Leo Fontaine), (Dante),
(Chris Clobber) (Karen Rontowski).


(Matt Wagner) (Bill Gladsone),
( - ). 15%, .
(Linda Morris), (Greg Cray),
(Rev Mengle), ,
Hungry Minds, Inc., , .
(Allen Wyatt) , ,
, ( ) ,
.
- , ,
, , .

, Microsoft Office
" " Visual Basic For Dummies. , .

.


, ,
. .
- , .
, , .
, ,
. . ; .
- , .
, ,
. Hungry Minds

.
, ,
, ,
, .
,
, , ,
.
"", 2- ,
,
, Visual Basic 6 For Dummies ( ), For Dummies ( , Dan Gookin), Visual C++6 For Dummies ( , Michael Hyman,
, Bob Arnson), C++ "" ( . , Stephen R.Davis,
Java Programing For Dummies ( . , Donald J. Koosis. ,
David Koosis), Window 98 Programing For Dummies ( . , Stephen R. Davis),
. , Richard J. Simon), Access Programing For Dummies ( ,
Rob Krumm), Borland C++ Bilder 3 For Dummies ( , Jason Yokes) (
IDG Books Worldwide, Inc.}.

tcHuia
, , , ,
. ,
.
| /
s
v'

16


, Mac OS, Palm, Linux, Windows 95/98/Me/NT/2000 Pocket PC
Visual Basic, C++,
Delphi .
, Liberty BASIC, -
, Web- w-rfw.libertybasic.com. , ... "".

/// &
, , .
, ,
,
. , , , ,
.

I.
, , .
, ,
, , ,
.
,
, , , ,
.
.

II. Liberty BASIC



. ,
.
,
, Liberty BASIC
. ; ,
.

III.
Liberty BASIC
Liberty BASIC
, . -

17

IV.
, .
, , .. .

. , .
,
, Liberty BASIC.

V. : ,

~ , ,
. , ,
, .
,
,
, . , . .

VI. Internet
Internet ,
Internet, HTML (, Web-), JavaScript Java.
Web-,
,
.
Web- Web-.

VII.
,
,
.
,
. , ,
, - . , C++
BASIC, , LISP, Oberon Python.

&
, ,
. ,
, ( , ).

18

, ,
,
.

, (
,
). , Windows 95,
Windows 98. Windows Me, Windows NT Windows 2000.
Windows 95, Windows 98, Windows Me,
Windows NT Windows 2000, Windows 95 "",
Windows 98 "" Windows Me "" (
"").
Windows NT Windows 2000 Windows NT 4.0 For Dummies
Windows 2000 Professional "" (
).

&
&&
, , , , .
,
( , ).
, .
! , .
,
.
,
, . (
,
,
.)

19

,]

"A MO*tVA SbllWb,

^!

, , , .
, .
, , , , . , ,
.
, , ,
.
, , , .
, , , ,
, , . ? , , , ,
, , , .



/3 & ...
>
>
>

, ,
. , .
, , . , , Internet, a
, . ,
, .

, tfM&fib
, ( , , ): ? ,
, .
| ^ . , ,
, , ,
. , .
; ,
,
.
, .
: V .
,
. ,
,
, ,
, . , , , .

1.

23

.
, .
,
; , ,
, . ,
, , . ,
.
. -
. ,
,
.
, ,
, , . , , . ,
, , , .

tfcuc ftadotHoetn >*6/& /^


, ;
, . - , .
.
/ , ,
, , .
v' , - ,
, .
, - , ( -
) .
,
, ,
. . 1.1 , , .

1.1.

, - ; -

24

I.

. 1.1

- , -


- ,

- , - -


(OCR)
,
Web-

HTML- (Hypertext
Markup Language -
}

HTML- Web -

-
, , . , , , .
, , , ,
, . ,
, .
, (,
, ) .
, ,
.
, ,
, .
, , , ,
, , , .
= ^ , ,
. ,
, .
, ,
, . ,
, ,
, , , -

1.

25

, ,
, .

;

-
. , , .
, , .
, , .
, ,
.
1.

X.

2.

Y.

3.

4.

.
1

, ,
"" .
1.

X?

2.

Y?

3.

4.

,
? ? ? ?

, , , .
: tj.ii ti, ^ .

, , ( ), ,
.
, 1980- -:
Sergeant York.
.
, , Sergeant York, .
, ,
, - .
, , Sergeant York,
. Sergeant York , , , Sergeant York -!
.

26

I.

, , Sergeant York , .
, . , Sergeant York , Sergeant York.
, - , , .


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

.
. ,
, (, ).
. , .
, .
, ,
.
, ,
. ,
: (,
C++), ..
( )
, .
1960- ,
2000, ,
2000 . , ,
; , . .

/,

27

-
8 8 . . .
>
>
>

,
"" , .
, .
, (, , , ). -
.
.
^/ {,

, "" , ,
. , .

.

, .
.
, , , . ,
, :

0010 1010 0001


1100 1010
0101 1101
1101
1111
0010

1101
1111
0101
1001

.
F S .
.
; ^ ( , ,
).

. , , .

28

I.


.
.
,
( JMP, MOV ADD), , .
. . ,
, :
I title Program
; This program displays "Take a nap!" on the screen dosseg
.model small
.stack lOOh
.data
my_message db 'Take a nap! ', Odh,0ah, '$ '
.code
main proc
mov ax,data
mov ds,ax
mov ah,9
mov dx, o f f set my_rnessage
int 21h

mov ax,4COOh
int

21h

main endp
end main

.
. ,
, , .
.
, , .
- ,
, , . .
,

s , , .
S , ,
( ).

, .
I / , , ( , )
, .
/ ( , ) , ,
.
</ ,
.
|
.

2. -

29

, ,
.
, , .



.
. , , COBOL FORTRAN. (
" ".)
, ,
( ),
, , ,
( COBOL FORTRAN).
, .

| ( ).
. , , . :
-- - - - - - :

imam (}

printf ("Take ! " ) ;


, , Take ! ( !).
,
. , ,
, , , , .
, , . , , , ,
. , ,
,
( ). ,
, , , . ,
, , , ( , ,
, ).
.
S .
V , ,
,
, .

30

I.

. , , . , .
, . ,
. ( , ,
,) ,
, .
,
, . , , ^ . ,
.
.
, ,
, . , , , , .
, , . . , , ,
, Ada LISP.

, . Macintosh,
, Windows 2000, . .
, ,
, , .
, ,
, ,
.
,
, . C++.
( ) , C++,
, Windows 95, Windows 98,
Windows Me, Windows NT, Windows 2000, UNIX Linux, ,
Quicken, Netscape Navigator Microsoft Word.
,
, .

2. -

31

^ , , , , .
S
, . ,
. , , .
, , , ,
, C++, Java #. , , . , Java #,
, .


, ,
, , FORTRAN,
COBOL, Pascal Ada. , , , ,
.
FORTRAN (
FORmula TRANslator). FORTRAN .
COBOL ( COmmon u si ness-Oriented Language),
. ,
FORTRAN COBOL ,
( , ).
,
Pascal BASIC, . BASIC
( Beginner's All-purpose Symbolic Instruction Code)
, , . , .
- .
BASIC . Take ! ( !),
:
;

PRINT

"Take

!"

,
, ,
BASIC, , , .
Pascal (
, Blaise Pascal) , , . BASIC
Pascal , Pascal -

32

I.

, . ,
. Take !
( !), Pascal, :
.........
: Program Message (Input, Output);
Begin
Writeln ('Take a nap!');
End.
, Pascal, ,
BASIC, .
,
. Pascal ,
, . , .
,
. ,
, - ,
. , BASIC .
BASIC ,
Pascal BASIC BASIC. Liberty BASIC
( 5) BASIC.
, , Pascal, BASIC,
FORTRAN, Ada COBOL, , .
, , , , .

, ,
.
, (, Norton Utilities), (
).
. ,
.

(, Ada),
.
Ada .
Ada .
Ada,
. Ada , , COBOL, FORTRAN, BASIC Pascal.

2. -

33

, ,
Pascal, BASIC, FORTRAN, Ada COBOL,
, .
.


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

, , , .
, , .
, ()
.


RAD
, , . ,
.
- , C++, BASIC Pascal .
:
PRINT "This sentence appears on-screen."
, , , .
, ,
RAD.
RAD , ( ). . 2.1 Visual Basic.
RAD: Visual BASIC (
BASIC), Delphi ( Pascal) C++ Builder (
C++).
RAD .
v' .
S RAD .
, . ,
RAD, -

34

I.

,
. .
, RAD (BASIC, Pascal C++), ,
RAD.

/. 2./. 1^/ #as/c



, RAD .
, .
, RAD,
. , Visual Basic
Windows 95, Windows 98, Windows Me, Windows NT Windows 2000.
Visual Basic Macintosh, Linux .
, .
, RAD,
, , C++, BASIC Pascal. RAD .
.


, C++, BASIC Pascal,
. , ,
.
:
, , , , . .

2. -

35

, : , , .
- . , .
, ,
. , ,
, C++
BASIC. . , C++, .
. .
dBASE, FileMaker,
FoxPro Microsoft Access .
, SQL (Structured Query Language ).
Take !, dBASE :

!row = 15
|column = 15
I clear
L@ row, column SAY "Take a nap!"
.

, ,
C++ Pascal.
. , .
, . .
^ . , , FileMaker, , FileMaker. - ,
FileMaker Windows Macintosh, , Linux.
/ . , , , (,
), . .


,
. ,
.

36

I.

C++
Pascal, , , , .
, , . ,
(, WordPad, WordPerfect Microsoft Word)
. (
).
.
, Microsoft Word, Excel,
PowerPoint Access, , Visual Basic for Applications (VBA), Visual
Basic. Macintosh
, Apple Script.
.
, AppleScript Take ! ( !):
On Display/Message ( )
display dialog "Take a nap!" (buttons
end DisplayMessage
Display-Message ( )

{"OK"}

.
1 ^ ,
. , .
/ ,
(,
C++). , |
.
,
, .

. , , ,
. , Microsoft Word, , Microsoft Word ( , Windows, Macintosh).
. ,
,
( , ..), . WordPerfect, , Microsoft Word, .

2. -

37


, (, C++). , .

Web-
Internet
, ,
, , Web-.
, ,
.
, HTML (HyperText Markup Language). Web .
HTML , .
Web-
HTML (. 2.2) , . 2.3.
Web, , .
Web- "" ( , ..), Web-: Java, JavaScript VBScript.

http-quiu="cont*nt-typ"
arfit-15-85-1">

book*, canting. Fitneu, gardening booKt</titl>

I,

finance book, htnl book. Hnagntct nook, linux book, uitiiedij book,
fitnee* book, programing book, c book, cae book. h"llh book, cooking
book, nltrtiining, gardening baok.vt book, tut prip, certification,
bookstore office . offic* ST. office 38. nerd 298 uord 97, c*l
2836, xetl 9T. icctit ZD06. . Hindout B5. Hindon* nt. HindflHt
toon, duiiiee poctcard gen*4logy. quicken computer bo
intirnit, idg bookt">
nfl
<HETfl nin''dcription" conlnt'"For Duiiit*
DuHi*t * Nituork. onlin* rtourei> for tunnology ,
uttr-frinaiy coKputir no g*n*r*l intvnet boott; find new book*, buy

. 2.2. HTML ,

Java
( ) , Web. , ,
Java, Take a nap!
( !):
__~~

. .

._~.....

.......

..

....

<: Public class DisplayMessage {


public static void main (String args[]) {
system, out .print In {"Take a nap!");

38

I.

-4i

DUMMIES
BOOK TOPICS
Technolog

1 4

Dummies Daily *
eTips

Fortify your brain with a


Delivering
advice OR more than 40 topics from AOL to Windows, Internet
Taok t MP3, Careers to Travel
our Hi point you in the
right direction. Dummies Daily
makes you a tittle smarter
every day.

Create Your

Own
Custom Book
oreBook!
Mix and match
chapters from a
large menu of
Hungry Minds
books Including
Frommer's and
For Dummies
guides and get a
custom eBook or
print-on-demand

. 2.3. HTML, . 2.2, ,


Web- Web, , . Web- Web- ,
.
Web-
.
Web-, ,
.
Web-
. Web-
Internet.
Web- .
Web-, JavaScript VBScript. , Web-.
/ , Internet
( 28,8 /),
,
Web- (, VBScript). , Web-.
^ (, Java)
,
Internet. , -,
, Web.

\-/

2. -

39

?
.
,
( C++),
(, SQL). C++, .
, , .
C++, .
, COBOL. , , . .
,
.
, SQL VBA, Microsoft Access. Web-,
HTML, Java, JavaScript, VBScript Internet. , .
C++, BASIC, Java, SQL .
, , Web- www. latech.edu/-acm/HelloWorld. shtml.
,
. "Hello World!".

40

I.


& ...
>
>
>
>
>

, ,
, ,
, .
, , , - .
, ,
, ,
.

Jlftexcqe . nfiotftcuuitf
, , ,
, . , ,
.

.
^ . ?
/ .
? , Windows 95/98/Me/NT/2000 Mac OS, Amiga, , , Palm OS
PocketPC, ?
/ .
? ,
|
?


,
, ,
, . -

3.

41

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


, ,
,
. ,
,
, .
, ,
Macintosh, , , . , , Palm, ,
.


, . , . , C++, , .

,
, , , Mac OS Windows 95/98/Me/NT/2000. , , . , Microsoft Word , Mac GS, Windows.
, ,
,
, . ,

42

I.


,
,
.
, WordPerfect MS DOS,
Windows, Macintosh, Amiga Atari ST. ; ,
. ,
.
,
WordPerfect , Amiga Atari ST.



. ,
, ,
( , ).
,
. C++. ,
, , BASIC.
,
C++, . ,
Visual Basic, ( ) .
,
. ,
, .


, . ! " ,
".
. - ; . ,
, . ,
, ,
,
, .
.
, ,
. , , , , , .
..

3.

43


, Visual Basic, , , C++,
.

noqfw$HOCffiu

. . , , , , .


, ( )
, ,
. , ,
,
() .
,
.
, . ,
, , .
, , , .
Visual Basic, . Visual Basic , ,

.


,
, .
.
, , .
, .
" " ,

44

I.

, .
, ,
.

.
C/C++
C++ ,
,
,
. C++
.
/ . C/C++

(
).
s . C/C++,
,
( , ) . ,
,
.
s . , C/C++ ,

.
C/C++, , C/C++.
s . C/C++ .
C/C++, ,
.
s .
, . C/C++
, .
</ . C/C++
. , ,
(, , ),
, ,
. ( 15, "
".)

3.

45

Windows Macintosh
C/C++, , .
, C/C++.

Visual Basic
Visual Basic
( C/C++). , C/C++, Visual Basic .
. Visual Basic
,
. , ( ) .
. Visual Basic,
.
. , ,
, .
Visual Basic ""
.
S .
,

Visual Basic, , , , C/C++.
, Visual Basic .
/ . , Visual Basic, ,
. ,
, Visual Basic .
/ . Visual Basic , .
, .
S . Visual Basic , Windows 95/98/Me/NT/2000
PocketPC, , ,
,
. Visual Basic Macintosh ,
,
C/C++.
, Visual Basic . , C/C++,
Visual Basic.

46

I.

Delphi
Delphi Visual Basic,
Pascal. Delphi , Visual Basic C/C++,
. ,
Delphi ( ) Visual Basic C/C++. Delphi .
. , Delphi , Visual Basic, , C/C++,
.
. Delphi
, Visual Basic.
, Visual Basic.
. Delphi , C/C++, . , Delphi, , , C/C++. Delphi
(
C/C++), , , "'1 , .
, Delphi , Visual Basic,
, C/C++,
.
| / . Delphi
Pascal, , C/C++.
,
, Delphi, .
. Delphi , ,
.
, C/C++ ,
. Delphi , Windows 95/9S/Me/NT/200Q Linux, , , , . Delphi Macintosh
, ,
C/C++.
Delphi , , ,
C/C++. Delhi
, Visual Basic. Delphi,
.

Java
Java , . Java, ,
- ( ),

3.

47

Internet. , .
. Java
,
( , ) (Windows, Macintosh Linux)
- .
, C/C++. Java
C/C++, . Java
, , C++.
C/C++. Java C/C++,
, C/C++,
Java.
Java , 5(/ Microsystems (
) . , Java .
. , Java,
, ,
C/C++, Java.
. Java C/C++, .
, Visual Basic Delphi.
. , ,
Java, .
Java
, . -
, .
Java , ,
Java. ,
, Java , Visual Basic Delphi C/C++.


, C/C++, Visual Basic, Delphi Java,
, LISP Prolog; . , ,
Clarion PowerBuilder.
, ,
(, Microsoft Access) , .

48

I.

.
*

.
. , ,
Visual Basic.
. ,

. , , C/C++ Visual Basic.

, ,
| ^ . , . , ,
.
. , , , , , C/C++.
. ,
, (
, ).
. ,
, dBASE
FileMaker, ,
. , , Microsoft Access, , .
|
.


, ,
Visual Basic. , .
, . ,
, .

3.


(, C++),
, . , C++, ,
Pascal
. . , , , .
Microsoft Windows DLL, ..
. DLL , , , Java
COBOL. Visual Basic,
, DLL.
{,
Pascal), .
( ,
.)
, .


,
. , , () ,
, . .
, , -
100 , , .
1.
2.
3.
4.


.
.
.

, ,
.
,
,
. "
", "" , . .
1. .
) .
6} , ;
.
) .
2. .

50

I.

3, .
4, .
,
.
1.
) .
) ,
.
.
, .
, . :
,
.
2. .
3. .
4. .
,
, , ,
. ,
( , ), , , , ,
.
. ,
, , , .

, ,
. , , ,
(C/C++, FORTRAN, Pascal, Java
..), .

&* //,
, . - , , . (
, .)
, (
), (
), ( , ).

3.


.

. .
1. .
2. .
3. ,
.
4. .
5. .
6. .
7. .
8. -.
9. - .
10. . 7-8 .
11. ,
12. -.
13. - .
14. . 9-10 .
15. , , ,
.


, . , , ,
,
, - .
, .
1.
2.

52

, , .
.

3.

, ,
, .

4.

, .

5.

. 14 ,
.

6.

- .

7.

, .

I.


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

.

, -.
. 17 ,
.

, ,
.

" ",
, . ,
, , . ,
.

3.

53


>
>
>
>
>



""

, . , ,
.
, , .
.
^j

| s ( ).
, ,
, .
, ,
.
,
, ,

..
.
( ).
(
, ).
(
).
,
Visual Basic, Delphi Visual C++, , , , .

54

//
.
,
,
.
**^

( ANSI) , , . ANSI . ANSI American National Standards


Institute ( ).
,
, . , ,
.

, , . ;

. , , , .
Linux

. ,
, , , .
,
, ,
( ,
).
( } Linux.
.

( ) .
, ,
, , , , .

. , ,
, . , MS DOS , EDLIN.EXE. , , . ,
.

4.

,
, , , , .
. 4.1. , .
VBAProlect - ThisOocnment ()

Sqr(Wiim6er Ai DoutteJ As Double ;

. 4. L Visual Basic ,

utttfiefinft&naiiiofia
, C++
Java. ? ,
. , ,
(, C++ Java) ,
.
/
^

, , .. , . , .

.

56

I.

, , .
( Microsoft PowerPoint Lotus 1-2-3) .
,
( ).
,
, PowerPC (
Macintosh) Intel Pentium ( , , AMD
Athlon). BASIC
Macintosh Windows,
Macintosh Windows.
,
| . * , C++
, , , .

,
. .
, , .
,
, . ,
.
, .
- , , - , ( ,
),
.
Web-, JavaScript VBScript. Web- , , JavaScript VBScript, .
.
, , , . , ,
, . . ,
, , .

4.

57

-:

. , Macintosh Windows ,

Macintosh Windows.

, -.

, - . ,
-, .
, -.
, -, Java.
Java -
, Mac OS, Windows Linux. -, ,
.
, -
, .. , ^ .
, Liberty BASIC,
, BASIC ,
-. ,
Liberty BASIC,
, Liberty BASIC - .
, - . ,
-, , , . , - , , .
- , . ,
Java -, Java. , - .
,
. ,
-, , . , C++, COBOL. FORTRAN,
BASIC, Ada, LISP, Pascal .
, , . ,
.
, .

58

I.

?
, ,
. , Web-, -. , , -. ,
.
, , , , -. ,
, Java, , -.
, , C++,
-.

100% ,
, ,
. ,
, , ,
.
, , ( , bug , ).
.jMvtiff , . . ; .
, ,
, . , , ,
,
.
, 100% ,
, (, Windows 2000) .
, , .. , . ,
.
, , .
,
, (

4.

59

), , . (, , ), .
.
s . , ,
. , , . ,
, .
^ . , ,
,
. , ,
, ,
, .
.
/ . ,
, , .
(,
), , . . 4.2 , ,
. , , ,
, .
, ,
.
,
. , ,
. , ,
.
, , .

/tatftcu
,
, ,
.
, , .
, ,
, . ,
, .

60

I.


Watch Properties

. 4.2. , ,
,
. , .
. , , .
. 4.3 , .
, , ,
.
, .
,
.

4.

Logitech MouseWoie

{^] |
13 Using ' Cuslomjjing tie Mousfjj
'2\ Making Bulto Assignments3 Button Options
?J Using AutoScroll
21 Using Universal Scroll
- 21 Using Overjump
: 3 Using HyperJump
-,2] AOjusnng Cursor Accelerotin
- .3 Adju sting Cu rsor Speed
: J3 Maximizing Mouse P.espon5
: ! Using CureorTrails
- jj Changing Pointer Shape or >
I ^Selling Up Smart Move
1
: 12! Adjusting Double-dickTimiT
. 12) Changing MouserTracKOall i
I F 121 Selling Uo Your Mouse'or
[3 Displaying Ihe MouseWare I

Before you use -.-. you must first


assign this function to a mouse Button See
"Making Button Assignments' far more
infarrnairori.
I Press and hold the assigned Cytjerjump
mouse button to display the CyberJump grid
Click on parts of the grid shown Below 1C Display
additional information

:
2 To execute a CyberJump command, move
Hie screen pointer a command i-cn :ie
CyherJump grid. The command is executed
automatically

. 4.. ,

&

, ,
, . -, ,
. , . ,
, .

, .
, . , .

,
,
.
.
. ,
. - ,
, -.
.
, - .
,

62

I.

, . ,
. , , .
. ,

, .
, .
, ,
,
.

4.

63

11


Liberty BASIC

# bMM6VwM.HL*i, Miwo
MV^XtM,

&

, (C/C++, BASIC, Prolog, Java,


COBOL, Perl, Ada ..), :
. ,
(, BASIC),
,
(, C/C++ Java) .
,
Liberty BASIC, Windows, .
Liberty BASIC Internet, , .
Liberty BASIC,
(C/C++, Pascal Java),
, . , ,
, -.

:
Liberty BASIC
&,,.
>
>
>
>
>
>

Liberty BASIC
Liberty BASIC
Liberty BASIC
Liberty BASIC
Liberty BASIC
Liberty BASIC

^^ - .
,
.
, : Pascal, LOGO SmallTalk.
BASIC. , , ,
.
, Liberty BASIC,
, , 2 . ,
Liberty BASIC, , Windows 95/98//
NT/2000. , , .

iberty
, : C/C++? , , Liberty BASIC
.

Liberty BASIC ()
Liberty BASIC - ,
, , . , , , Visual Basic Visual C++.

5. : Liberty BASIC

67

Liberty BASIC
Liberty BASIC ,
. , C++
Java, ,
, - , .
, , ,
Liberty BASIC.
Liberty BASIC,
, C++ Java.

Liberty BASIC Windows


MS DOS, Microsoft BASIC, QBASIC.
QBASIC Windows (, Windows 98,
Windows 2000), BASIC Windows,
.
Microsoft Windows QBASIC, Liberty BASIC. Liberty BASIC ,
Microsoft Windows, , .
Liberty BASIC,
Windows . Liberty BASIC .

iberbf
Liberty BASIC, Internet
Web- www.libertybasic.com, , i n t a l l . e x e , . ,
, Liberty BASIC, , Liberty BASIC, .
ZIP-.
, WinZip,
Web- Nico Mak Computing (www. w i n z i p . com).
Liberty BASIC ,
.
1. -, WinZip.
2.

Liberty BASIC, Internet .

3.

Liberty BASIC .

4.

5.

6. .

68

II. Liberty BASIC

7.

8.

9.

i n s t a l l . e x e , Liberty BASIC . 3,
.

10. .
11. .
12. Liberty BASIC
.

& Liberty
Liberty BASIC, Liberty BASIC .
Liberty BASIC, .
1. Windows.
2. .
3. Liberty BASIC^Liberty BASIC.
4.

Liberty BASIC.
Liberty BASIC, Windows.

Windows,
.
1.

Windows.

2.

3.

^.

4. .
5.

6.

7.

Liberty BASIC (Liberty.exe), .

8.

,
.
, .

9.

10. .
11. , Liberty BASIC, , .
12. Liberty BASIC . Liberty BASIC , .

5. : Liberty BASIC

69

ibertif
, BASIC Liberty BASIC. Liberty BASIC, :
| P R I N T "This BASIC program mimics a really bad boss."
|PRINT
iPRINT "What is your name?"
LINPUT Name?
: PRINT "Hello " -*-Name$+". You're fired!. Have a nice day"
'-END
Liberty BASIC, BASIC,
, , .. , .
BASIC.
, Liberty BASIC
, , ,
.
.
1.

This BASIC
program mimics a really bad boss. ( ).

2.

3.

what
name? ( ).

4.

, . <Enter>, Name$.

5.

Hello (), , You' re fired! . Have


a nice day. ( . ). "+"
Name$,

6.

, .

is

your

Liberty BASIC
BASIC,
<Shift+F5> Run^Run (^) Liberty BASIC. ,
Liberty BASIC, , . 5.1.

70

//. Liberty BASIC

END

! iaiiaasfflBaiii'aiij TTTii

Edit

rhis BASIC ptogcan mimics a really bad boss.


Bhat is your name?
7Vlad
iello Vied. You'ce f i r e d ! . Have a nice day.

(Thu unrigi*rad wel aft*era compiles only small programs.

. 5.1. , Liberty BASIC


, Liberty BASIC , . , , .

, Liberty BASIC
Liberty BASIC, .
.
, .
1.


Liberty BASIC.

2,

Save As ( ).

3.

Filename ( ).

4,

File^Save

(^)

.
.
Liberty BASIC .bas . , , ,
BASIC.

5. ; Liberty BAS/C

71

,
Liberty BASIC
Liberty BASIC
. , , .
, .
1.

File^New File ( ^ )
Liberty BASIC.
, ,
.

2.

Yes (), ,
No (), .
Liberty BASIC ,
.

, .
1.


Liberty BASIC.

File^Open

(^)

, ,
.
2.

Yes (), ,
No (), .
Open a BAS File ( ).
.

3.

, ,
.

.
Liberty BASIC . . . 5.1 ,
Liberty BASIC.

5.1. Liberty BASIC


<>

<End>

<5+>

<Delete>
<Backspace>

72

, ,
,

II. liberty BASIC

. 5.1

<Ctrl+F>

<Ctrl+A>

<Ctrl+Z>

&

iberty JSdSJC
Windows, Liberty BASIC . , .
1.

Help^Contents ()
Liberty BASIC.
, .

2.

3.

, Liberty BASIC.

4.

, .

/ fiaJorfibt Liberty
, Liberty BASIC, - .
Liberty BASIC, .
1.

File^Exit Liberty BASIC


Liberty BASIC) .

(^

, ,
.
2.

Yes (), ,
No (), .
Liberty BASIC.

3.

Yes (), Liberty BASIC


( No (), ).
Liberty BASIC .

5. : Liberty BASIC

73

> - :
> - :
>

(), - ,
- ().
,
, , , , . , , .
, , , ,
,
, .
.
, BASIC C/C++,
. , , ,
- . , ,
,
.

-.:
-
. .
, .
.
, (,
).
, (,
Web- , , , )
, .
.

74

II. Liberty BASIC

(, , )

.
BASIC PRINT,
, . PRINT
What are you looking at? (
?), . 6.1:
PRINT -"What are you looking at?"
END

^
looking at?

Li

. 6.1. PRINT
PRINT Liberty BASIC .
, , NOMAINWIN. ,

( 14, " "), .


BASIC, , , . , C/C++ , ,
main, , , :

6.

75

main (,)
, C/C++, |
. , ,
- , ,

, That sounds like the name of a moron! ( - !}:

main ( )
.{
char rayboss [15]
printf ("What is the name of your boss?" \n) ;
scanf ("%s", myboss);
printf ("%s", myboss) ;
printf {"?,That sounds like the name of a moron!");
_)
_
_____
__
__
__
|
PRINT ; INPUT , .
, , ,
, :
, PRINT "What is the name of your boss?"
i INPUT MybossS
! PRINT Myboss$ + "? That sounds like the name of a moron!"
LEND- :

Liberty BASIC,
W h a t is the name of your boss? ( ?). <Enter>, ,
That sounds like the name of a moron! (
- ! ) , . 6.2.
at unfitted.bus complete.
Eile fgft
what 1 the name of youc boss?
Bill
Bill? That sounds like the name of a moconi

., ]

1LJ

. 6.2. INPUT

76

II. Liberty BASIC

\S-*r/

j{e PRINT
INPUT,
. Windows

(Graphical User Interface GUI).


. , PRINT INPUT, , , .

, . , , Liberty BASIC
BASIC.


,
. ,
PROMPT, , (, ), , , :
I PROMPT "What is the name of your boss?"; name$
,
. 6.3.

l is BIB d your boss?

. 6.. PROMPT
,



Notice (). NOTICE, , . NOTICE
, .
Notice . 6.4.

6.

77

NOMAINWIN -

I PROMPT "What is the name of your boss?"; name?


;NOTICE name$ + "? That sounds like the name of a moron!"

;END

BillTThati

. 6.4. NOTICE

, .. . Liberty BASIC LPRINT DUMP, :


;LPRINT "Save the dolphins! Kill the t u n a ! "
i DUMP
' END
LPRINT , .
DUMP .
, DUMP, LPRINT
.
LPRINT . ,
,
, .
,
LPRINT, :

;LPRINT

.LPRINT "Save the dolphins! Kill the tuna!" | DUMP


;
END
LPRINT ,
Save the dolphins! Kill the tuna! ( . !)
,
SPACES ( x ) . , . , , SPACES ( 5 ) , :
|LPRINT "Save the dolphins! Kill the tuna!"
|LPRINT SPACES(5);
S DUMP

"Save the dolphins! Kill the t u n a ! "

:
[Save the dolphins' Kill the tuna!

78

II. Liberty BASIC

SPACES ( x ) ,
,
.
. 14
,
.

6.

,

arfiou ...
>
>
>

,

, .
, , . , , , , .
,
, . ,
.

^j ,

, , . - , .
,
. , ,
- . , , , . :

S ;
/ ,
.
, .
, ,

. , ,
, PhoneNumber -
.

80

II. Liberty BASIC

,
, . ,
Liberty BASIC .
, S, 7.
, My.Boss.
: My BOSS.

,
. . .
,
Phonenumber PHONENUMBER
Liberty BASIC.

Liberty BASIC, END PRINT.

,
(case-sensitive). , C/C++, Java # ,
Pascal BASIC .
(Liberty BASIC , .)
.
(Salary) , , (TaxOwed) :
'NOMAINWIN
Salary = 25000
TaxOwed ^Salary .* . 95
NOTICE "This is how much tax you owe = $";
TaxOwed
END
.
1.

Liberty BASIC
.

2.


Salary 25000.

3.

: Salary 0,95,
TaxOwed.

4.

:
, This is how
much tax you owe ( ),
TaxOwed.

5.


Liberty BASIC ,
. , .

7. ,

81

.
.
PROMPT ,
.


. , :

.. . . . .,,.

:CEOSalary = 9000000

jMessage2Workers$ = "So I make more than I ' m worth. So what?"


CEOSalary 9000000.
Message2Workers$ So I make
more than I ' m w o r t h . So what? (, , .
?).
, $. , $ .
- ,
(0) ("").


, ,
. ,
:
\ DumpestPersonlQ = 6
j B o s s I Q = DumpestPersonIQ/3

Liberty BASIC BossIQ. 3 DumpestPersonlQ.


BossIQ.
, :
I Cry$ = "I want to eat"
iNewCry$ Cry$ + "food that is really bad for m e ! "
CryS I want
to eat ( ). NewCry?.
$ food that is really baci
for me! (, !).
, NewCryS I want to eat food
that is really bad for me! ( , !).
, Liberty BASIC
, :

82

II. Liberty BASIC

NQMAINWIN
Parents ~ 2
Whacks = 20
MotherAxWhacks" = Parents * Whacks
FatherAxWhacks = MotherAxWhacks + 1
FirstName? = "Lizzie"
LastName$ = "Borden"
FullName$ = FirstName$ + LastName$
NOTICE FullName$ + ." had an ax,
str$(MotherAxWhacks)+_
"wracks. When she saw what"
+ chr${13)+ " she had done, gave_
her father " + str$(FatherAxWhacks)
END

gave

her

mother

+chr$(13}+

!"

.
1.
2.

Libety BASIC,
.
Parents 2.

3. Whacks 20.
4. MotherAxWhacks.
Parents ( 2)
whacks ( 20). (40)
MotherAxWhacks.
5.

6.

FatherAxWhacks. 1 MotherAxWhacks ( 40).


(41)
FatherAxWhacks.
FirstName$
Lizzie. ( ,
FirstName $, ,
.)

7.

LastNameS
Borden.

8.

FullName$
FirstName$ LastNameS. , FullNameS L i z z i e
Borden. ( ,
LizzieBorden.)

9.

Notice, FullName$ ( L i z z i e Borden),


had an ax, gave her mother ( ,
).
, Liberty BASIC
.
10. (
ASCII- 13), MotherAxWhacks ( 40) wracks, when she
saw what (. , ).

7. ,

83

11.
( ASCII- 13), she had
done, gave her father ( , ).
12. FatherAxWhacks ( 41).
13. Liberty BASIC .

, PROMPT
PROMPT ,
, .
PROMPT
. (, 49)
,
Salary. TaxOwed :
'NGMAINWIN
PROMPT "How much money did you make last
year?"; Salary
TaxOwed = Salary * .95
NOTICE "This is how much tax you owe = $";
. TaxOwed
END

.
1.

Liberty BASIC,
,

2.

HOW
much money did you make last year? ( ?). - , Salary.

3.

Salary 0,95. TaxOwed.

4.

Notice
This is how much tax you owe = $ ( =
$); TaxOwed.

5.

Liberty BASIC .


, ,
Liberty BASIC, "
, PROMPT0, :
main {)

'float salary, taxowed;


printf ("How much money did you make last year?");
scanf l"%f", ssalary);

84

. Liberty BASIC

taxowed = salary * /95


printf ("This is how much tax you owe = $%8.2f"
, (, )
, $ , , YourName$. $
Liberty BASIC , , ,
.

.
'NOMAINWIN
PRJMPT "What is your name?"; YourNarne$
Message$ =, YourName$ + ", you deserve a raise!"
.NOTICE Messages
"

END

.
1.

Liberty BASIC,
.

2.

what is
your name? ( ?). - , YourNameS.

3.

, you deserve a r a i s e ! (,
!)
YourNameS. Messages.

4.

Notice ,
Kessage$.

5.

Liberty BASIC .


Liberty BASIC 45.

. 2, 45.


.
, ,
, , , , .
, BASIC
. , , - .
" ". ?
,
, , ,

7. ,

85

. ( : Parents, Whacks,
MotherAxWhacks, FatherAxWhacks, LastName$, FirstNameS FullNameS.)
( - ) , , C/C++ Pascal,
. .
| / , .
I J , .
, , , .

Liberty BASIC
BASIC, , BASIC, .
BASIC (,
Visual Basic, Liberty BASIC), DIM, :
}DIM Eyeballs

Eyeballs.
, , :
DIM Eyeballs,

Bullets, Logs

Eyeballs, Bullets, Logs.


, ,
, , . QBAS1C ( BASIC,
Liberty BASIC), , , :
;DIM Parents, Whacks, MotherAxWhacks, FatherAxWhacks, LastNameS,
First-Name;?, FullNameS
Parents = 2
Whacks = 20
MotherAxWhacks ~ Parents * Whacks
FatherAxWhacks = MotherAxWhacks + 1
FirstName$ = "Lizzie"
LastName$ = "Borden"
FullHame$ = FirstNarne$ + LastName?
PRINT FullName$ + " had an ax, gave her mother ";
MotherAxWhacks;
PRINT " wracks. When she saw what she had done, gave her";
PRINT " father ";FatherAxWhacks
, (LastName$, FirstName$ FullName$), a
(Parents,
W h a c k s , MctherAxWhacks, FatherAxWhacks).

86

II. Liberty BASIC

fl \

Java

Java C/C++, C/C++,


Java. ,
, Java, ,
, , QBASIC, Java:
public class TrivialApplication
public static void main (String a r g s U )
int parents, whacks, motheraxwhacks, fatheraxwhacks;
String lastname, firstname, fullname;
parents = 2;
whacks 20;
motheraxwhacks = parents * whacks;
fatheraxwhacks - motheraxwhacks + 1;
firstname = "Lizzie";
lastname = "Borden";
fullname = FirstName$ + LastName;
S y s t e m . o u t . p r i n t l n ( f u l l n a m e 4 " had an ax/ gave her
mother " 4motheraxwhacks};
System.out.println("wracks. When she saw what she had done,
gave h e r " ) ;
System.out.println (" father " -fFatherAxWhacks); .

, Java, ,
, QBASIC.
.
,
, ( Liberty BASIC)
, . .
S , . ,
, ( )
, .
S ,
.
, , ,
IQ integer, ]
:

int

IQ

Pascal :
Program Main;

7. ,

87

Var
JQ: integer;
BASIC, Visual Basic, :
DIM IQ AS INTEGER

;
, , .

&
;
. ,
.
. 0,1975?
Balance = 43090
OurFrofit Balance * .1975
PRINT "Pay this amount, or we'll get you = ";
Balance
PRINT "Today's current loan sharking interest
rate ="; .1975
END
0,1975. , . .
Liberty BASIC
BASIC, . BASIC
(, Visual Basic ) .
,
, Pascal:
LProgram UnderstandingConstants;
;Const
InterestRate = 0.1975;
i Var

OurProfit : real
Balance : real
'-, Begin
i Balance := 43090
7 OurProfit := Balance * InterestRate;
Balance := Balance + OurProfit;
W r i t e l n . ( 'Pay this amount, or we'll get you = ' , Balance:6:2};
-."-, Writeln (*Today's
current
loan
sharking
interest
rate
iInterestRate:1:4);
I.End.
, :

88

II. Liberty BASIC

[Pay this amount, or w e ' l l get you - 51600,28


[Today's current loan sharking interest rate = 0,1975
0,1975 ( 9 12).
0,1975 0,2486, ,
1975 0,2486.
, , ,
. .
, ,
. ,
,
Pascal, interestRate
0,1975 0,2486 ( 3).
9 12, InterestRate.
.
.

, .

, , . , , ,
, .
( , ) (,
, ), .
.
V
/
S
S
S ,
S ,
Liberty BASIC
.

V ( REMark )
V (')

REM
. , -

7. ,

,
.
\ ' 29 199
- ' John Doe
[,-
j ',
',
' ,
REM
REM ,
REM , 1
REM ,
.NOMAINWIN '
NOTICE "He , "
_ END '
, :
NQMAINWIN
^NOTICE "He , 1
:END

,
. REM .
.
, . , , ; , .
, Liberty BASIC
.
, ,
, , :
NOMAINWIN
\ ' = SQR((B*B}+ (C+CJ)
. END

. Liberty BASIC :
]NOMAINWIN
| END


, :
:NOMAINWIN

j A = SQR{{B*B}+ ( C + C ) )

;END

90

//. Liberty BASIC


8 & ,..
>
>
>
>


Liberty BASIC

f^ , , ,

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

, ,

, , . ,
.
, , ( , ) ,
. 8.1.

8.1.

2+5

77-43

34

20/4

4*7

28

8.

23

91

(/)
, (?), . ( ) <6> .

, 34,5 90.
, , ,
, .

. , 43 Liberty BASIC 4 . : 43=4*4*4=64.


(, , )
, :
'TaxYouOwe = 125000 * 1.01

(, 125000*1,01), , :
:'PROMPT "How much money did you make last
year"; Netlncome
ITaxYouOwe Netlncome * 1.01
|NOTICE "You owe this much in taxes = ";
TaxYouOwe

; END

,
, . ,
, 1,01.
, :
'TaxRate = 1 . 0 1
PROMPT "How much money did you make last
year; Netlncome
TaxYouOwe = Netlncome * TaxRate
,NOTICE "You owe this much in taxes = ";
TaxYouOwe

; END

( TaxRate 1,01),
, 1,01 .
.
S
S ,
.

, Liberty BASIC , , .
, , ,
.

92

II. Liberty BASIC


, NetIncome*TaxRate, ;
, .
, , , , :
jTaxYouOwe PastTaxes + Net Income

TaxRate

Net Income 50 000,


TaxRate 1,01, PastTaxes 25 000, :
;

TaxYouOwe = 2500 + 5000 * 1.01

, : Liberty BASIC
2500 50 000, 1,01 ( 53025} 50 000 1,01,
2500 ( 53 000).
, , , , ,
,
. Liberty BASIC , , .. .
" ( )
(*) ( ); (/)
(+) ()
, ,
:
, = 3 + 4
I PRINT

/ 5

FEND

, Liberty BASIC,
.
1. .

, Liberty BASIC 4"5,
1024. :
! = 3 -f 1024 - 8 / 5 * 7
.
,
, .
8/5 ( 1,6),
7. ;
1 = 3 + 1024 - 11.2
, ,
.
3+1024 ( 1027);
11,2. :

8.

93

: = 1015.8
2.
, 1015,8.
3. .


, ,
.


. , ,
,
. , :
BigValue = 3 + 4
; P R I N T BigValue
! END


(45=1024), 3, 1027.
, 3 4,
?
, , :
'BigValue = (3 +
PRINT BigValue
END.
3 4,
BigValue = 7 5 , 16 807.
- , , .
, .
, (3+4).
, (3+45), , ,
. ,
, , :
EasyTaxCode = { { 3 + 4)

5 / 3 - 8) / 5 * -7

, Liberty BASIC
.
.
, , , "", :
X - -87.09

Liberty BASIC, , (1)


, :

94

II. Liberty BASIC

; = {0 - 87.09)
:
; = -1 * 87.09)

&& iberttf
,
. ; Liberty BASIC (
)
, . 8.2.

8.2. Liberty BASIC

ABS(X)

ACS(X)

ASN(X)

ATN(X)

COS(X)

()

INT(X)

, X

LOG(X)

X ( , X )

SIN(X)

TAN{X)

X
, ,
. , , , * , Liberty BASIC , , .

S Q R ( X ) , .
Liberty BASIC ,
, 0,5, :
i..

I .- 9 / ' 5 ... . .
_ .. . . ..
.
....
9, 3.
, Liberty BASUC,
0 1:
PROMPT "Type in
I PRINT "The ABS
:PRINT "The ACS
ppRINT "The ASN
;PRINT "The ATN

a number"; AnyNumber
value ="; ABS (AnyNumber)
value = "; ACS(AnyNumber)
value = "; ASN(AnyNuinber)
value = "; ATN[AnyNumber)

8.

95

PRINT
PRINT
PRINT
PRINT
PRINT
PRINT
PRINT
END

'The
'The
'The
'The
'The
'The

COS
INT
LOG
SIN
SQR
TAN

value
value
value
value
value
value

=
=
=
=
=

COS(AnyNumber)
INT(AnyNumber)
LOGfABS(AnyNumber))
SIN(AnyNumber)
(ABS(AnyNumber) 0.
TAN(AnyNumber}

.
0
1,0. ,
Liberty BASIC .

,
. ,
, , (#, & +), .
Liberty BASIC , , :
PRINT "Everything enclosed in 'quotation marks"
PRINT "is a string, including the numbers
below: "
PRINT "12 - 9 * 8"
PRINT "You can even mix letters and numbers
like this"
PRINT "I made $4,500 last month and still
feel broke. "
END
72 = 9*8 ,
, , , Liberty BASIC .


,
:
\ PRINT "Print me."
!PRINT 54
- END

-^i^^

C/C++

BASIC ( , Pascal
Java), C/C++ . C/C++ ,
( char).

96

II. Liberty BASIC

(, , , ), C/C++
. ( . 16, " ". ,
, C/C++, ,
, BASIC.)
, , ,
C/C++, , .
myrelative , 10 :
char myrelative { 10 ];
printf ("Type of a male relative you h a t e . \ n " ;
scanf ("%s", smyrelative) ;
printf ( " % s " ,

Smyrelative) ;

p r i n t f ("says he doesn't like you e i t h e r ! " 0 ;


, ,
, . , , ,
, ,
.
Liberty BASIC,
. ,
. , Liberty BASIC
, {$) ,
:
StringVariableS = "This variable can hold
" only strings."
,
, Liberty BASIC . , , , Liberty BASIC, , .


, ,
. { ).
, "",
:
=PROMPT "What is your name?"; MyNanme&
' P R I N T "Hello, " + MyName$ + "- Isn't it time

to take"
PRINT "an early lunch from your job now?"
: END

ft /

97

, Liberty BASIC,
.
1.

2.

3.

4.

What is your name? ( ?).


MyName$.
, MyNameS. , MyNameS Tasha, Tasha. Isn't it time to take (Tasha.
).
an
early lunch from your job now? (
).
.

, , , (). Hello
.

Liberty
fradb/fot
, Liberty BASIC
. Liberty BASIC
,


, .
,
,
( ) ( )
,
LOWERS. UPPERS.
, :
! UPPERS ("hello") ' HELLO
!
LOWERS ("GOOD-BYE") ' good-bye
, , :
PROMPT "What would you like to convert?";

ThisString?
PRINT "This is what happened when you use

LOWER$:"
PRINT LOWER${ThisString$)

98

It. Liberty BASIC

PRINT
PRINT "This is what happened when you use
UPPER$:"
PRINT UPPER$(ThisString$)
PRINT
END

I D o n ' t Like Anyone Who


Copies My W o r k ( , ), :
This is what happened when you use LOWERS:
i don't like anyone who copies ray work
This is what happened when you use UPPER$:
I DON'T LIKE ANYONE WHO COPIES MY WORK
, LOWER$ UPPERS, . ($, % @) .


, . ,
LEN, :
.
.
;LEN("Greetings from Mars!")
20 , . LEN , :
;PROMPT "Type a string:"; CountMe$
!TotalLength = LEN(CountV\Me$)
;PRINT "The total number of characters in your string is:"
I PRINT TotalLenght
END

, Beware of copycat
publishers, :
:The total number of characters in your string is:
28
LEN , . 8.3.
8.3, LEN

"

6 { )

Hello!"

"What are you looking at?

24 ( )

"Boo! Go away!"

13 { )

8.

99


,
, .
, Liberty BASIC
:
;TRIM$("
Hello, there!") ' "Hello, there!"
jTRIM$("Good-bye!
") ' "Good-bye"
, TRIMS , :
j A s t r i n g S = " Hello, there!"
i P R I N T "The original length of the string = ";
LEN(Astring$)
TempString$ = TRIMS(Astring$)
PRINT TempStringS
PRINT "The new length is now = ";
LEN(TernpString$)
END

:
~~

~"

|The original length of the string = 14"


I Hello, there!
j The new length is now = 13


, .
Liberty BASIC $$:
jSPACES(X)

X ,
. SPACES
Hello () the cat ( ):
.Astring$ = " the Cat."
PRINT "Hello" = SPACES(5) + Astring$
(END


, . , - , .

Liberty BASIC.
LEFTS (string, X) X ,
.
RIGHTS (string, X ) ! X ,
.
MID$ (string, X, Y) Y , X .

100

II. Liberty BASIC

, , :
FakeNarne$ = "John Barkley Doe"
FirstName$ = LEFT$(FakeName$, 4)
PRINT "This is the f i r s t name = '
LastName$ - RIGHT$(FakeName$, 3)
PRINT "This is the last name = ",
MiddleName$ = MID$( FakeName$, 6,
PRINT "This is the middle name =
END.

FirstName$
LastName$
7)

'; MiddleName$

"" , John
B a r k l e y Doe.


, -
. , , :
!"John, Julia, Matt, Mike, Sam, Chris, Karen"
Matt, INSTR, :
Names$ = "John, Julia, Matt, Mike, Sam, Chris, Karen"
Position = INSTR{Names$> "Matt", 1)
PRINT "The name Matt is located in position = "; Position
END

, Liberty BASIC,
.
1.

$
John, Julia, Matt, Mike, Sam, Chris, Karen.

2.

Position , INSTR.
INSTR : " , ,
Name$, Matt".
Matt 14- .

3.
4.

: The name Matt is located in


position ( Matt )= 14.
.

INSTR,
.
, .
1,
.
, . 20-
, Matt Name$.

8.

101

S , .
s (), ,

, , Matt MATT .
INSTR MATT, , Matt MATT :
:

Names? = "John, Julia, Matt, Mike, Sam, Chris, Karen"

Position - INSTR{Names$,

"MATT",

1)

^PRINT "The name Matt is located in position = "; Position


j-END

INSTR , , .

( )
, .
, , . , ,
:
: P R I N T "555-1212"

555-1212. ,
, .
, :
:

PRINT 555-1212?

Liberty BASIC : " 1212 555 ( 657) ".


, ,
Liberty BASIC, STR$, :
'STR$(}

STR$ Liberty BASIC ,


. , 34 STR5 34.
, PRINT :
!BossIQ = 12
PRINT "This is the IQ of your boss = "; BossIQ

; END

STR$,
BossIQ :
BossIQ - 12
Newstring$ = "This is the IQ of your boss = " + STRS(BossIQ)
PRINT NewString$
END

102

II. Liberty BASIC

,
BosslQ NewString$.
, Liberty BASIC .
(, 4 6) .
,
Liberty BASIC VAL, :
;

VALf"")
VAL Liberty BASIC , , . , "45" 45.
VAL , ,
"Hello", VAL .
VAL , :
YearBorn$ = "1964"

PROMPT "You were born in "; YearBorn?


Year = 1999 - VAL(YearBorn$)
NOTICE "In 1999, you were this old - "; Year
END
, You were born in ( ) 1964.
In 1999, you were this old ( 1999 ) 35.

8,

103



% & ...
>
> IF THEN
> Select Case

^^ . ,
, "Hello,
world ! "
(", ! ") .
, ,

.
, ,
.
, , , "" , .
, ,
. , .

&
- , , ,
: " ?". , .
, , . ,
, " ".
,
{George Boole). (
, .)
,
. 9.1.

704

//. Liberty BASIC

9. 1.

4<54

4 54

4>54

4 54

4-54

4 54

4<=54

4 54

4>=54

4 54

4054

4 54

, <, >, =, <=, >= <>, .


, ,
:
IF (4 < 54) THEN
PRINT "This prints out on-screen."
ELSE
PRINT "Why did you pick this sentence?"
END IF
END
- . . , . , . .

,..

..

"

-.

,...

-vvLv

vv

, Liberty BASIC,
.
1.

(4<54). , .

2.

This prints out on-screen. (


,}.
.

3.

:
,
.

4.


Why did you pick this sentence? ( ?). (4<54)
"", .

5.

IF THEN
ELSE ( "IF THEN
ELSE" .)

6.

9.

105

:
;Guilty = (4 < 5 4 }
Guilty true. : " (4<54) . Guilty true".
Liberty BASIC
(true) (false). Liberty BASIC
true , -1,
true. Liberty BASIC false, 0.
:
Guilty = (4 < 54)
IF Guilty .THEN
PRINT "Slap him on the wrist and let him
go."
ELSE
PRINT "This sentence never prints out."
.END IF
;END
, ,
Slap him on the w r i s t and let him go. ( .).


(4<54),
, . .
, :
(MylQ < AnotherlQ}
< 100000)

(MylQ < AnctherlQ)


MylQ AnotherlQ. ,
,
MylQ AnotherlQ:
PROMPT "What is your IQ";

PROMPT "What is the IQ of another person";


AnotherlQ
IF (MylQ > AnotherlQ) THEN
PRINT "I'm smarter 'than you are."
ELSE
PRINT "You have a higher IQ to make up you
lack of common sense. "
END IF
END

106

II. Liberty BASIC

MylQ
Another IQ," , I'm smarter than you are. ( .), You have a higher IQ to make up your lack of common sense. ( IQ , .),
, .


,
:
PROMPT "How much money did you make"; Salary
PROMPT "How much money did you donate to
political candidates"; Bribes
[ I F (Salary > 500) THEN
IF (Bribes > 700) THEN
PRINT "You don't need to pay any taxes.
END IF
END IF
I END

You don't need to pay


any taxes. ( .), (Salary>500 Bribes>7 00) .
,
,
. , true false.
.

AND
OR
XOR
NOT

AND
AND () . ,
, AND:
PROMPT "How much money did you make"; Salary
PROMPT "How much money did you donate to
political candidates"; Bribes
IF (Salary > 500) AND (Bribes > 700) THEN
PRINT "You don't need to pay any taxes."
:

END IF
END

You don't need to


pay any taxes. ( .),
(Salary>500 Bribes>700) . , .

9.

707

, ,
. 9.2, .

9,2. AND
Salary

Bribes

100

100

100

900

900

900

900

AND true ,
, , true.
AND,
,
. . 9.3
:
! ( 1) AND ( 2}
.

9.3. AND

1

( 1)
AND ( 2)

False ()

False ()

False ()

True ()

False ()

False ()

False ()

True ()

False ()

True ()

True ()

True ()

OR
OR () , true
() , true ()
. OR,
:
1

PROMPT "How far can you throw a football";


Football
PROMPT "What is your IQ"; IQ
:
IF (Football > 50) OR (IQ <= 45) THEN
PRINT "You have what it takes to become a
professional athlete!"
END IF
! END

You have what it takes to


become a professional athlete! ( !)

108

II. Liberty BASIC

(Football > 50 IQ <= 45). , , .


, ,
. 9.4, .

9.4.
Football

IQ

70

70

70

70

OR false ,
, , f a l s e .
. 9.5 OR
:
;( 1) OR ( 2)

9.5. OR

1

( 1}OR
( 2)

False ()

False ()

False ()

True ()

False ()

True ()

False ()

True ()

True ()

True ()

True ()

True ()

XOR
XOR ( ) , true , true, a
false. :
PROMPT "Is your spouse around (Type 1 for Yes
or 0 for N o ) " ; SpouseHere
i PROMPT "Is your best friend around (Type 1
for Yes or 0 for ) " ; BestfriendHere
IF (SpouseHere = 0) XOR (BestfriendHere = 0} THEN
PRINT "You won't be lonely tonight!"
[.END IF
END
Y o u w o n ' t be lonely tonight! (
!) , (SpouseHere=l) true, (BestfriendHere=0) f a l s e , SpouseHere=0 BestfriendHere=l.

9.

109

(SpouseHere=l) (Bestf riendHere=l)


, . , (SpouseHere=0)
(Bestf riendHere=0) , .
, ,
. 9.6, .

9.6.

SpounseHere


Bestf riendH ere

1
1

XOR f a l s e ,
, , false true.
. 9.7 XOR
:
( 1} XOR ( 2)

S, 7,

1

( 1)
XOR ( 2)

False ()

False ()

False ()

True ()

False ()

True ()

False ()

True ()

True ()

True ()

True ()

False ()

NOT
NOT (HE) . true, NOT f a l s e . f a l s e , NOT true, ,.
.
, true:
.

_--

vv~v.

v^

- _

: (4 < 54)

~.

^.

false:
J N O T ( 4 < 54)
f a l s e Guilty,
:
; Guilty = NOT(4

54)

: " (4<54)
true. true f a l s e , -

110

II. Liberty BASIC

Guilty false".
NOT, :
Guilty = NOT{$ < 54) ' The value of Guilty is false
IF Guilty THEN
PRINT "This sentence never prints out."
ELSE
PRINT "The defendant is not guilty because
he's rich."
END IF
END

, ,
The defendant is not guilty because he's rich. ( ,
.).

& oneftaidofiaMU
, ,
IF THEN. ,
. .
IF THEN :
IF ( ) THEN
*
END IF
:
I PROMPT "Do you eat hot dogs? (Type Y for Yes
or N for No)"; AnswerS
IF {AnswerS - "Y") THEN
PRINT "I have a nice hot dog you might
like."
END IF '
END

Y ( ), I have a nice hot dog you might like. (


-, .).
, , IF THEN (, PRINT ), IF THEN
:
: PROMPT "Do you eat hot dogs? (Type Y for Yes or N for N o ) " ;
;AnswerS
IF (AnswerS = "Y") THEN PRINT "I have a nice
hot dog you might like."
, ,
IF THEN,
IF END IF, .

9.

111

PROMPT "Do you eat hot dogs? (Type Y for


Yes or N for No)"; Answer$
IF (Answers >= 1) THEN
PRINT "You have my sympathies."
PRINT "Have you ever thought of
getting"
PRINT "your head examined real
soon?"
END IF
END

IF THEN ELSE
IF THEN
- . ,
.
IF THEN ELSE IF THEN, , . IF THEN ELSE
:
IF (Boolean expression) THEN

'
ELSE
1
,
END IF
:
PROMPT "How long were you in medical school";
Answer
IF (Answer > 4) THEN

PRINT
PRINT
ELSE
PRINT
PRINT
PRINT
END IF
: END

"Congratulations! You should be able to"


"play a good game of golf in no time."
"You may not have been in medical school for"
"very long, but at least should know"
"how to put on a white lab c o a t . "

IF THEN IF THEN ELSE


- . , , C o n g r a t u l a t i o n s ! YOU should
be able to play a good game of golf in no time. (!
.).
, You may not
have been in medical school for very long, but at least should know
how to put on a w h i t e lab coat. (
, , .).
IF THEN ELSE . IF
THEN, .

112

II. Liberty BASIC

IF THEN ELSE IF
IF THEN ELSE IF , ,
,
. IF THEN ELSE I F :
! IF ( 1} THEN


= ELSE IF ( 2) THEN


' END IF
IF THEN ELSE IF :
PROMPT "How long did you go to law school?";
Answer
IF (Answer > 4} THEN
PRINT "Congratulations! You now know enough to"
PRINT "sue your law school for wasting your time."
ELSE IF (Answer > 2) THEN
PRINT "You may not have finished law school yet"
PRINT "but that doesn't mean you can't lie about i t . "
END IF
END

, 4,
Congratulations ! You now know enough to sue your law school for
wasting your time. (! , .)
: ,
, ,
ELSE IF, .
3 4,
You rr.ay not have finished law school yet but that doesn't mean you can't
lie about it. " ( , ,
. ) ,
2, 1 ? .
IF THEN ELSE , :
IF ( 1) THEN
1

ELSE IF ( 2) THEN
*
ELSE IF ( 3) THEN
1
-
END IF

, ,
10, 4 1 :
I PROMPT "How many millions did your government
waste last year"; Answer
; IF (Answer > 8) THEN
PRINT "Congratulations! You must live in a true"

9.

113

PRINT "democracy."
'.ELSE' IF (Answer > 2) THEN
PRINT "You government isn't spending enough. Tell them"
PRINT "to start buying weapons they don't need."
[ELSE IF (Answer > 0) THEN
FEINT "Your government obviously concerned with"
[ PRINT "staying under budget, which means it's not"
PRINT- "likely to last much longer."
fEND IF
| END
10, (Ar.wser>8),
Congratulations ! You must live in a
true democracy. (! .)
4, (Anwser>2),
You government isn't spending
enough. Tell them to start buying weapons they don't need. ( . ,
.),
1, ELSE IF <Anwser>2), Your government obviously concerned
with likely to staying under budget, which means it's not last much
longer. (
, , .)

onefta&ofia Select Case


IF THEN ELSE IF
, :
PROMPT "How old are you"; Answer
IF (Answer > 21) THEN .
PRINT "Congratulations! You must be able to rent a"
PRINT "car in some states."
ELSE IF (Answer > 20) THEN
PRINT "You can't rent a car, but you're
preapproved" "
PRINT "for 20 different credit cards."
ELSE IF (Answer. > 19) THEN
PRINT "You're still o f f i c i a l l y a teenager."
ELSE IF (Answer > 18) THEN
PRINT "You're old enough to join the military and"
PRINT "fire an automatic rifle, but you still can't"
PRINT "buy beer legally. Figure that one out."
ELSE IF (Answer > 17) THEN
PRINT "You can see R-rated movies on"
PRINT "your own {but you've probably done that for y e a r s ) . "

END IF
END

IF THEN ELSE IF
SELECT CASE, :

774

II. Liberty BASIC

' SELECT CASE


.CASE !
i, * , = !
CASE 2
' , = 2
END SELECT
BASIC, Liberty BASIC
SELECT CASE.
BASIC, QBASIC Microsoft.
IF THEN ELSE IF, SELECT CASE
.
SELECT CASE, :
INPUT "How old are you"; Answer
SELECT CASE Answer
CASE 21
PRINT "Congratulations! You must be able to rent a"
PRINT "car in some states."
CASE 20
PRINT "You can't rent a'car, but you're preapproved"
PRINT "for 20 different credit cards."
CASE 19
PRINT "You're still officially a teenager."
CASE IS
PRINT "You're old enough to join the military and"
PRINT "fire an automatic rifle, but you still can't"
PRINT "buy beer legally. Figure that one out."
CASE 17
PRINT "You can see R-rated movies on"
PRINT "your own (but you've probably done that for years)."
END SELECT
| END

21,

Congratulations! You must be able to rent a car in some states.


(!
.). 20, You can't rent a car, but you' re pre-approved for 20 different
credit cards. ( ,
20 .).
19, You're still officially a
teenager. ( .). 18, You're old enough to join the military
and fire an automatic rifle, but you still can't buy beer legally.
Figure that one out. ( ,
, .
, .). 17,
You can see R-rated movies on your own but
you've probably done that for years. (
, .).

, , SELECT CASE, 22 16, SELECT CASE ^


.

115

,
SELECT CASE, CASE ELSE:
| I N P U T "How old are you"; Answer
SELECT CASE Answer
CASE 21
- PRINT "Congratulations! You must be able to rent a"
PRINT "car in some states."
CASE 20
PRINT "You can't rent a car, but you're pre-approved"
PRINT "for 20 d i f f e r e n t credit c a r d s . "
CASE 19
PRINT " Y o u ' r e still o f f i c i a l l y a teenager."
CASE 18
PRINT "You're old enough to j o i n the military and"
PRINT " f i r e an automatic r i f l e , but you still can't"
PRINT "buy beer l e g a l l y . Figure that one out."
,CASE 17
PRINT "You can see R-rated movies on" PRINT "your own (but you've probably done that for y e a r s ) . "
\CASE ELSE
PRINT "This sentence prints out if the user does NOT"
PRINT "type numbers 17, 18, 19, 20, or 2 1 . "
:

END SELECT
: END

21, Congratulations! You must be able to rent a car in some states.


(!
.)- 20, YOU
can't rent a car, but you're pre-approved for 20 different credit
cards. ( , 20 .). 19,
You're still officially a teenager. ( .). 18, You're old enough to join the military and fire an automatic
rifle, but you still can't buy beer legally. Figure that one out. (
, ,
. ,
.). 17, You can
see R-rated movies on your own but you've probably done that for
years. ( , .). (,
54 97), This sentence prints out
if che user does NOT type numbers 17, 18, 19, 20, or 21. ( ,
17, 18, 19, 20, 21.)


SELECT CASE ,
, 21 "".
, , 3
18. :

116

II. Liberty BASIC

;CASE
i . .
i
.. .
. .

. _

. . .

. _,

~J

,
1 10, .
INPUT "How many water balloons do you have";
Answer
SELECT CASE Answer
CASE 1 TO 10

PRINT "You need more water balloons."

- -

CASE 11 TO 1000
PRINT "Now you need a target."
CASE ELSE
PRINT "What are you? A peace-loving hippie freak?"
END SELECT
END

, 1 10, You need more water balloons. ( .). 11 1000, Now you need a target. (
. ) . , 1000,
What are you? A peace-loving hippie
freak? ( ? ?).
, SELECT CASE, :
'SELECT CASE Answer
CASE 1 TO 10

PRINT "This always prints."


CASE 5 TO 10
PRINT "This never prints."
; E N D SELECT
SELECT CASE
This always prints. ( .), 1 10, This never
prints. ( .) CASE 5
10. , SELECT CASE ,
.



. , , , . SELECT CASE , (>),
.
,
IS, :

;CASE
is <= s
i .,.

..;

_ .

^ ^^-

, 5 , :

9,

117

INPUT "How -many cats 'do you own"; Answer


SELECT CASE Answer
CASE IS <= 5
PRINT "You need more cats."
CASE IS > 5
PRINT "Are you out of your mind?"
SELECT
;END
, 5, You need more cats. ( .).
, 5 5, Are you out of your mind? ( ?).
,
SELECT CASE, :
SELECT CASE Answer
CASE IS < 10
PRINT "This always prints."
CASE IS < 12
PRINT "This prints only if the user types 11."
END SELECT
This always
prints, ( .),
10, This prints only if the user
types 11. ( ,
11.), 11.

SELECT CASE C/C++ Java


BASIC /ix , Pascal, SELECT CASE
, , You' re still officially a teenager, (no
.) QBASIC ' Select Case", 19.
C/C++ Java . , SELECT CASE ( C/C++ Java ), break.
, , , :
^include <stdio.h>
main ()
char akey;
printf ("Type a lower case letter " ) ;
scanf(" " ) ;
- scanf {"%c" , Sakey};
switch (akey) {
case 'a' .: printf ( " Y o u pressed the A k e y . n " ) ;

118

II. Liberty BASIC

'b'

: printf ( " Y o u pressed the k e y ) . \ n " ) ;

<>, :
You pressed the A key ( )
You pressed the A key ( )
C/C++ Java , . , , C/C++ Java, , break:
#include <stdio.h>
main {}
char akey;
printf ("Type a lower case letter ");
scanf{" ");
; scanf {"%c" , &akey};
switch {akey) {
case 'a' : printf ("You pressed the A key.Xn");
break;
case %b' : printf ("You pressed the key.\n");
C/C++ Java, , C/C++
Java, , BASIC.

9.

119

10


/3 &
> WHILE WEND
> FOR NEXT

, ,
, .
, ,
, ,
.
, , . , . , , 1 5:
-PRINT
PRINT
PRINT
PRINT
PRINT
END

1
2
3
4
5

, 1 5000000, , ? . , , . .
, FOR NEXT:
FOR I = 1 5
PRINT I
NEXT I
END

:
1
2
3
4
5

, , .
, , . , ,
1 5 I 5000000 ( ).
.

120

//. Liberty BASIC

,
, , . , ,
. (
7, ", ".)
, , , , .
, , true false.
, true
false, ',
9, " ".
4>9,48 ( false).

wtaze

. , , ,
.
, ,
fa ,
. , , .
.
. Liberty BASIC
WHILE WEND:
WHILE ( = true)
*
: WEND
,
WHILE WEND, :
| WHILE I < 5
PRINT "The square of "; I;

?*

.
1.

I 1.

10.

121

2.

, , ,
WHILE WEND, , 1<5.

3.

The
square of 1 is 1 ( 1 1)
WHILE WEND, The s q u a r e cf 2 is 4 ( 2 4) WHILE WEND ..

i. I 1, 1 + 1, .. 2.

1<5.
, .
( I 1, 2, 3 4), , .. .
, :
I The square of 1 is 1

( 1 1)

The square of 2 is 4 ( 2 4)
The square of 3 is 9 ( 9)
The square of 4 is 16 ( 4 16)

6.

N1:

, , .
, , ,
,
;

!i = 1
WHILE I < 5

PRINT "This loop never ends."


'WEND
i END

, I . , 1<5 ,
WHILE WEND . This loop never ends. (
.).
, WHILE WEND
, I, ,
1=1+1, :

1=1

WHILE I < 5
PRINT "This loop eventually ends."
WEND
END

722

II. Liberty BASIC

, . , .

N2:

, WHILE WHEND, :
WHILE I < 5

1
= 1
1

PRINT "This loop never ends."


1 = 1-1-1
WEND
END
I 1 WHILE WHEND, 2 .
WHILE WEND I 1, , 5
.
WHILE WEND, i=i :
1 = 1
WHILE I < 5

PRINT "This loop eventually ends."

I = I + 1
WEND
END

__

__ ______^

. .,

...............

_.^_

I 1 , WHILE WEND. , I ,
5, , 1<5 ; WHILE WEND .
,
.
S , , WHILE WEND. , .
/ ,
WHILE WEND.
.

10.

123


, WHILE WEND,
( ) . ,
, .
, . , FOR NEXT, Liberty BASIC :
[ FOR counter = _ __
'
sNEXT
, FOR NEXT, . -. FOR
NEXT :

FOR I = 1 10
PRINT "The square of
NEXT
END

I; "is

, .
1.

I .

I.

The square of 1 is 1 ( 1 1).


I ,
:
The
The
The
The
The
The
The
The
The
The

square
square
square
square
square
square
square
square
square
square

of
of
of
of
of
of
of
of
of
of

1 is 1 ( 1 1)
2 is 4 ( 2 4 )
3 is 9 ( 9)
4 is 16 ( 4 16)
5 is 25 ( 5 2 5 )
6 is 36 ( 3 6 )
7 is 49 { "7 49)
8 is 64 ( 8 6 4 )
9 is 81 ( 9 81)
10 is 100 ( 10 100)

3.

4.

, FOR
NEXT , :
I FOR counter -= 8 2
1

NEXT

124

II. Liberty BASIC


FOR NEXT 1
, 10. FOR NEXT - ,
:
FOR I - to 14
PRINT "The value of I = ";!
NEXT
END

:
I The

I'The
!The
[The
; The
["The

value of I = 8

value
value
value
value
value

of
of
of
of
of

I = 9
I = 10
I = 11
I = 12
I = 13

" T h e value of I = 14

- , :
FOR counter = -5 3
'
NEXT

-, 1. , .


FOR NEXT - . , :
FOR counter - 1 4
v

INEXT

- , FOR NEXT STEP:


;FOR counter = 1 4 STEP
'

INEXT

, , -
2, FOR NEXT :
FOR counter = 1 8 STEP 2
PRINT "The value of I = "; I
NEXT

10.

125

, , ,
:

I The value of I = 1
[.The value of I = 3
|The value of I = 5
-The value of I = 7

"" , . - ,
:
' FOR counter = -8 STEP
PRINT "The value cf I = '
NEXT

FOR NEXT ,
, FOR NEXT , :
main
int counter;
f o r )counter = 1; counter <= 5; counter++)

printf ("The square of Id is %d\n",

counter,

counner * c o u n t e r ) ;

FOR NEXT : " counter -;


1 (counter=l). - j
1 (counter++) , (counter <= 5)
. ". ( FOR NEXT .)
FOR NEXT , .
, BASIC, .
, FOR NEXT ,
:
j The value of I=
|The value of I = 3
I The value of. 1 = 0
= The value of I = -3
The value of I = -6

126

II. Liberty BASIC

III



Liberty BASIC

, - i
, , - I
, |
. Liberty BASIC, ]
, !
.
, , |
. , ,
Liberty BASIC, , ,
/-- Java, Liberty BASIC
1 ,
[ , /**, .

11


6 / ...
>
>

>
>

77"

, .
, (, ..)
.
,
( , ), .
; .
, , ?
, , , , .
^/

& / noqxoq
ic // 6 /,
, .
, , ( ,
, ).
- ,
, . ,
, , ,
- .
, , .
, .
, .
; ;
,
.

, -

11.

129

( , , ).
, , , .

. , GOTO LebelCne , LebelOne.
GOTO ,
.
GOTO ,
349, 349 34, 34 125 ..
, , "".
, , Liberty BASIC:
:GOTO [LabelOne]
\ [LabelFour]
PROMPT "How much money do you have?"; MyCash
GOTO [LabelThree]
I [LabelTwo]
EHD
; [LabelOne]
GOTO {LabelFour}
[LabelThree]
PRINT "You owe me = "; MyCash - .95
GOTO [LabelTwo]
.~

, ,
, .
- , .
1.

, LabelOne ( ).

2.

3.

, LabelFour ( ).

4.

5.

:
How much money do you have? (
?), , , MyCash.

6.

, LabelThree (
).

7.

8. : You owe me = (
),
MyCash, 0,95.

730

///. ...

9.

,
LabelTwo ( ).

10. .
11. .
, , :
PROMPT "How much do you have?"; MyCash
PRINT "You owe me = "; MyCash * .95
END
, IF THEN SELECT
CASE ( 9, " "), .
. ,
.

" " , - , . ;
, , (
GOTO). ,
.



.


- ,
, :
PROMPT "How much stuff did you steal last year"; Amount
TaxesOwed = Amount * .95
PRINT "This is how much tax you owe ="; TaxesOwed
END
, . - ,

11.

131

. ,
, . , , (,
FOR NEXT) ,


(, IF THEN) . ( IF THEN 9, " ".) , , ,
:
PROMPT "How much s t u f f did you steal last year"; Amount .
TaxesOwed = Amount * .95
PROMPT "Are you a professional criminal (Y or N ) " ; Answer
IF (Answer = . " N " ) THEN
PRINT "This is how much tax you owe ="; TaxOwed
ELSE
PRINT "Lawyers and politicians don't need to pay taxes."

-.

END

, . , ,
.


.
, ,
FOR NEXT WHILE WELD.
FOR NEXT .
WHILE WELD , . , ,
WHILE WELD, (
10, " ").
, , ( "open"),
, :
PROMPT "What is the password"; Passwords
WHILE Password? <> "open"
PRINT,"Wrong password, moron. Try again."
PROMPT "What is the password"; Password$
WEND
PRINT "You typed the correct password!"
END' -.

132

III. ...

, , , , , .

( 10, " ").


, ,
. , ,
, .
, , ,
. ,
, , ,
. , ,
- .
, , , , :
"
PRINT "This program prints a message, of your"
PRINT "choosing, on the screen."
'PROMPT "What message do you want to appear"); Message$
PROMPT "Display message in all UPPERCASE (type 0) or lowercase
1}?"; WhatCase$

(type

.'
- IF WhatCase$ = "U" THEN
Messages = UPPER$(Message$)
.END IF
I IF WhatCase$ - "1" THEN
Message$ = LOWERS(Message$)
['END IF
'

;FOR i = i TO is

PRINT SPACE$(I -f 4 ) ; Message$


;NEXT
| END
, ,
, . , ,
( , )
.

11.

133

//
,
, , , . ( .
, Windows 2000,
, .)
, , . , ,
, . . , (,
) , , .
, ( ). ,
, ,
.
, , . ,
.
,
.
, ,

.
- ,
, . , ,
, .
, , ,
. , ,
:
.
, , , , , . , , .
1.

2.

3.

, .


, .
,
.
.

134

III. ...

. , .
.
. ,
,
,
.
, , .
,
.
Liberty BASIC, .

END .

, [, ].
RETURN,
,
.
,
. - ,
[warning].
RETURN .
Liberty BASIC :
|
'-
END
i,
;[]
.
I
i RETURN
, , , END,
,
.
, , ,
GOSUB:
GOSUB

11.

135

,
, . , ,
GOSUB, :
" 1
!GOSUB []
i 2
END


, GOSUB
. RETURN ,
GOSUB. , END.
,
, :
:NOMAINWIN
'PROMPT "What is your password?"; password$
'IF password$ = "open" THEN
NOTICE "You typed a valid password."
: ELSE
NOTICE "Invalid .password. "
GOSUB fhackeralert]
fEND IF

; END
1

[hackeralert]
I PROMPT "Are you a hacker? (Y or N)?"; answer$
i-IF answer$ = "Y" THEN
NOTICE "The police are on their way to pick you up now."
I ELSE
NOTICE "Then you roust be incompetent."

I END IF
RETURN

NOMAINWIN
END. [hackeralert] 11-
18- RETURN.
[hackeralert] ,
what is your password? ( ).
, . , , .
, Liberty BASIC,
,
, PACMAN.BAS BLACKJAK..

136

III. ...

,
. , , Liberty BASIC
. . ,
, , ;
.

Liberty BASIC , .. , . , , .
, - ,
. , , ,
.
.
, , .
, C/C++, Java Pascal,
.
. ,
, ,
, , .
. , .
cos (X) SIN ( X ) , Liberty BASIC.


.

,

( )

Liberty BASIC :
SUB _
'
END SUB
, , :
. SUB _
s

:EMD SUB

11.

137


,
. ,
. , ,
, ,
. , , :
SUB
PRINT " ."
END SUB
,
Liberty BASIC. ,
, .
, , -
- . - , ,
:
:SOB
' -

SEND SUB

, .
.
, , .

, .
,
. , , :
|SUB !, 2,
'
I END SUB
, ,
. .
| SUB Name$, Age
4


'END SUB

, ,
, .

138

III. ...


,
. ( ) , .
, ,
. : ", ! !"
BurnOutMonitor, CALL. BASIC :
;CALL BurnOutMonitor
BurnOutMonitor , :
;CALL BurnOutMonitor 45
( _^

_^

._.___.

CALL, ,
, . , Liberty BASIC,
DisplayMessage displaymessage .
,
. ,
END. ,
: must be a moron (
) . sounds like an idiot to me
-, )..
NOMAINWIN

PROMPT "Give me the name of someone you hate:


CALL DisplayMessage enemy$
END

(,

enemyS

SUB DisplayMessage s t u f f $
X I N T ( R N D d ) *2) + 1
IF X = 1 THEN
must be a moron.
NOTICE stuff$ +
ELSE
sounds like an idiot to me."
NOTICE stuff$ +
END IF
END SUB
Liberty BASIC .
1.

2.


Give me the name of someone you hate: ( :). enemy$.

3.

DisplayMessage
, enemy$.
SUB DisplayMessage s t u f f S
END SUB.

11.

139

4.

5.

DisplayMessage,
s t u f f ? .

6.

( 1, 2)
X.

7.


, , stuf f $.

8.

.
, ,
CALL DisplayMessage.
END, .


,
. , ,
:
\ = * *

,
* * . ,
, .


( ), . , . .

/ ,
S , ( ,
)
V ,
Liberty BASIC :
FUNCTION _ ()

_ =
END FUNCTION

,
Liberty BASIC .


.
- () ,

140

. ...

. ,
, ,
, :
FUNCTION _ ()

__ =
END FUNCTION
( ), .
, , , :
FUNCTION

_ (! ,


_ =
END FUNCTION

2,

, , ,
. ( 8,
" ".) :
FUNCTION _(*$, Salary)

_ =
!SND FUNCTION

Note$
Salary. Note , Salary , 3,14.


, , .
, , , .
, Cube, :
: FUNCTION Cube()
Cube = * *
; END Function

,
:
; PRINT Cube(3)'

:
MyValue = Cube(3)

PRINT C u b e ( 3 ) .
1. PRINT cube(3) Cube 3.
, , .

11,

141

2. Cube. , ,
,
Number. Number 3.
3. Cube Number ,
Cube. Number 3, Cube 3*3*3, 27.
4. Cube , .
PRINT Cube ( 3 ) .
5. cube(3) 27,
PRINT C u b e ( 3 ) PRINT 21.
27.

142

III. ...

12


sidou
>
> ""
>
>


.
. , ,
, , .
Liberty BASIC.
, ,
.


,
, ,
. .

/
OPEN,
:
: OPEN " " FOR Graphics AS #graphWin
,
.
, .
:
. GRAPHICBOX tmain. graph, 10, 10, 150, 150
i OPEN " " FOR Window AS #raain
GRAFHICBOX :
jGRAPHICBOX #Windowhandle.boxname, xpos,. ypos, width, height
.

12.

143

1.

GRAPHICBOX , . , #Windowhandle.

2.

boxnarne .

3.

xpos (
X Y ).
, fwindowhandle.

4.

w i d t h h e i g h t .
, .

""
"" . - , ,
. , ,
.
LOGO "" -XD \| . .
Liberty BASIC ( ,
"" ), .
1. ( ).
2.

( ).

3.

( , ).

4. - .
, ,
, "" -
, .
Liberty BASIC
"" , :
^
/
^
^
s
s
^
/
^

144

UP. ( )
DOWN. ()
. ()
GO. ()
GOTO. () . ,
PLACE . () . ,
TURN. () - .
NORTH. ()
POSXY. ()

III. .

, "" , ( 4,
) , . 12.1.

. 12.1. " "


NOMAINWIN
WindowHeight = 300
WindowWidht = 250
OPEN "Graphics window" FOR Graphics AS #main
PRINT
PRINT
PRINT
PRINT
PRINT
PRINT
PRINT
PRINT
PRINT

#inain,
tmain,
#main,
#main,
fmain,
#main,
#main,
#main,
#main.

'"HOME"
"DOWN"
"NORTH "
"GO 35 "
"TURN 225
"GO 25 ri
"TURN 225
"GO 20 11
"FLUSH "

PRINT #main, "trapclose [quit]"


WAIT
[quit]
CON-FIRM "Are you sure want to quit?"; quit$
IF quitS - "no" THEN WAIT
CLOSE #main
END
.
1.

""
.

2.

(300) (250) ,
.

3.

, Graphics window.
ttmain.

12.

745

4.
5.

(
).

.

6.

, .

7.

,
35 , .. .

8.

225 .

9.


25 .
10. 225 .
.
20 .
12. FLUSH.
,
, .
13. trapclose,
, , ,
, [quit].
14. ,
- .
15. ( [quit])
, , . Confirm, . , #main.
16. .
FLUSH, "" , .
, "" , , .
, :
PRINT flmain,
PRINT ttmain,
PRINT #main,
PRINT #main,
PRINT tfmain,

"HOME"DOWN"
"NORTH"
"GO 35"
"TURN 225"

,i_;

, ,

, :
PRINT #main,

"HOME;

DOWN; NORTH;

GO 35;

TURN 225"

, (_J,
Liberty BASIC: " ,
. ".

146

III. ...

:
!PRINT #main, "HOME; DOWN; NORTH; go 35; TURN 225"
, :
| P R I N T ttmain, "HOME; DOWN;
NORTH; GO 35; TURN 225"
,
DOWN:
.PRINT #MAIN, "DOWN; GOTO x y"
,
() X .


, , SIZE:
;PRINT tfWindowhandle, "size X"
.

^*

1.

#windowhandle
.

2.

size X . X , (, 3 8). , (1).

, ,
. :
(5) (10):
NOMAINWIN
WindowHeight 300
WindowWidht = 250
OPEN "Graphics window" FOR Graphics AS Imain
PRINT flmain,
PRINT #main,
PRINT fraain,
PRINT #main,
PRINT #main,
PRINT #raain,

"HOME; DOWN; NORTH"


"SIZE 5"
"GO 35; TURN 90; GO 35; TURN 90"
"SIZE 10"
"DOWN; GO 35"
"FLUSH"

PRINT #main, "trapclose [quit]"


WAIT
[quit]
CONFIRM "Are you sure want to quit?"; quitS
IF quit$ = "no" .THEN WAIT
CLOSE imain
END

12.

747


- , ,
. , COLOR:
PRINT #Windowhandle,

"COLOR color"

.
1.

#Windowhandle .

2.

COLOR color . color


: black (), blue (), brown
(),
cyan
(),
darkblue
(-),
darkcyan (-), darkgray (-), darkgreen
(-), darkpink (-), darkred (),
green
(),
l i g h t g r a y (-),
palegray (-), pink (), red (), white
() yellow ().

, , . :
NOMAINWIN
WindowHeight = 300
WindowWidht = 250
OPEN "Graphics window" FOR Graphics AS #main
PRINT ftrnain, "HOME; DOWN; NORTH"
PRINT flmain, "COLOR darkgreen"
PRINT flmain, "GO 35; TURN 90; GO 35; TURN 90"
PRINT ftmain,'"COLOR DARKPINK"
PRINT ftmain, "DOWN; GO 35"
PRINT ttmain, "FLUSH"
PRINT tmain, "trapclose [quit]"
WAIT
[quit]
CONFIRM "Are you sure want to quit?"; quit$
IF quit$ = "no" THEN WAIT
CLOSE flrnain
END


, , ,
.
Liberty BASIC CIRCLE:
!PRINT #Windowhandle, "CIRCLE R"

148

HI. ...

.
1.

tWindowhandle ,
.

2. CIRCLE R , .
R, R (, 35 90).
, , COLOR, CIRCLE:
PRINT twindowhandle, "COLOR darkpink; CIRCLE R"

,
BACKCOLOR CIRCLEFILLED:
;PRINT tWindowhandle, "BACKCOLOR yellow; CIRCLEFILLED ;
, ,
. . 12.2. (. 12.2).
,

" "

.
NOMAINWIN
5
WindowHeight = 300
WindowWidht = 250
OPEN "Graphics window" FOR Graphics AS tmain
'PRINT
PRINT
:PRINT
;PRINT
;PRINT

tmain,
tmain,
fmain,
tmain,
#main,

"HOME; DOWN"
"COLOR red;. CIRCLE 40"
"PLACE 45 50"
"COLOR darkblue; BACKCOLOR yellow; CIRCLEFILLED 40"
"FLUSH"

PRINT tmain, "trapclose [quit]"


; WAIT
:

[quit]
: CONFIRM "Are you sure want to quit?"; quit$
!IF
quit$ = "no" THEN WAIT
1
CLOSE tmain
END
PRINT tWindowhandle, "BOX x y"

PLACE. () .


. Liberty BASIC . , BOX:
;PRINT tWindowhandle, "BOX x "

12.

149

.
1.

#Windowhandle ,
.

2.

BOX x , ,
(), .

, , COLOR, BOX:
;PRINT

flWindowhandle,

"COLOR red; BOX x y"

, BACKCOLOR
BOXFILLED:
.-PRINT fWindowhandle, "BACKCOLOR pink; BOXFILLED x y"
, ,
. :
NIMAINWIN
WindowHeight = 300
WindowWidht =250
OPEN "Graphics window" FOR Graphics AS #main
PRINT
PRINT
PRINT
PRINT
PRINT

#main,
frmain,
fmain,
#main,
fmain,

"HOME; DOW
"COLOR red; BOX 190"
"PLACE 45 50"
"COLOR darkblue; BACKCOLOR pink; BOXFILLED 80 80'
"FLUSH"

PRINT ftmain, "trapclose [quit)"


WAIT
[quit]
CONFIRM "Are you sure want to quit?"; guit$
IF quit$ = "no" THEN WAIT
CLOSE tmain
END


, , . , () , .
, .
NIMAINWIN
WindowHeight = 300
WindowWidht =* 250
OPEN "Graphics window" FOR Graphics AS #main
PRINT fmain, "HOME"
PRINT trnain, "\This is an"

150

HI. ...

!PRINT tfmain, "\example of text"


,PRINT thnain, "FLUSH": PRINT ftmain, "trapclose [quit]"
: WAIT
|{quit]
CONFIRM "Are you sure want to quit?"; quit$
I IF quit$ - "no" THEN WAIT
i CLOSE #main
': END
(\)
, . 12.3. ,
() .
,
. ,
COLOR:
;PRINT tmain, "HOME"
- PRINT #main, "COLOR red"
This Is an
I PRINT Imain, "\This is an"
example of text
:PRINT #main, "\exaraple of text"
I PRINT tmain, "FLUSH"

.
, ,
Puc. 12.3.
BACKCOLOR:
, PRINT #main, 'HOME"

PRINT teain, 'BACKCOLOR red"
PRINT tmain, '\This is an"
PRINT #main, '\EXAMPLE OF TEXT"
PRINT #main. 'FLUSH"
.

. ,
. , , .


Liberty BASIC ( ) . :
:

PROMPT "How many beeps do you want to hear"; Answer


FOR I = 1 TO Answer
BEEP

': N E X T

12.

151

, - .

.WAV
,
Liberty BASIC PLAYWAVE. .WAV, Internet.
.WAV : \ W i n d o w s \
Media .
PLAYWAVE, , . W A V .
. WAV.
SYNC. ,
.WAV
ASYNC. . WAV
LOOP. .WAV ,
PLAYWAVS "",
PLAYWAVE :
!PLAYWAVE filename, mode
t a d a . w a v ,
: \windows\Media, :
|PLAYWAVE "C:Windows\Media\tada.wav",

SYNC

tada.wav.
, .
, PLAYWAVE , . WAV.
, Liberty BASIC,
:
'NIMAINWIN
:FILEDIALOG "Pick a -WAV file to play.", "*.wav", filenames
!PLAYWAVE filename$, SYNC
i END
, .
1.

Liberty BASIC .

2.

, .WAV.

3.

,
.
4. .

752

///. ...

13



3tfti)U . . .

>
>
>

/\, - (, , ),
(, ). , .
, ,
.
, ? , ,
.
, .

6 tfceiectfiogbtx,
, ,
, , (#, ~, < &), .
, , . , ,
, .
.
, ,
,
, Linux, Macintosh
Windows. ,
. ,
, .


, () .
Liberty BASIC :
I OPEN "_" FOR OUTPUT AS ^Handle

13.

153

.
1.

OPEN
(, STUFF.TXT C:\WINDOWS\
STUFF.TXT).

2. , FOR OUTPUT,
.
3.

#Handle "", .

, STUFF.TXT ,
:
'. OPEN "A:\STUFF.TXT" FOR OUTPUT AS ^Secrets
Liberty BASIC STUFF.TXT #Secrets.

, OPEN
, CLOSE . .


, PRINT . PRINT, Liberty BASIC
, Liberty BASIC ,
, :
:PRINT tSecrets, " ."
Liberty BASIC ,
#Secrets, :
.
:
" A : \ S T U F F . T X T " FOR OUTPUT AS ^Secrets
"PRINT #Secrets, " ."
I CLOSE ttSecrets
: END

, Liberty BASIC,
.

754

1.

STUFF.TXT. #Secrets.

2.

#Secrets : .

3.

#Secrets.

4.

///. ...

, , : STUFF.TXT, Windows , .



OPEN, , Liberty BASIC ,
:
! OPEN "A:\STUFF.TXT" FOR OUTPUT.AS tSecrets
Liberty BASIC : "
".
STUFF.TXT ? OPEN Liberty BASIC
STUFF, .
,
- , APPEND:
' OPEN "A:\STUFF.TXT" FOR APPEND AS ^Secrets
Liberty BASIC,
STUFF.TXT, , , ^
OPEN "A:\STUFF.TXT" FOR OUTPUT AS ^Secrets
PRINT
ftSecrets,
" ,"
CLOSE
flSecrets
OPEN "A:\STUFF.TXT" FOR APPEND AS ^Secrets
PRINT #NewStuff, " ."
CLOSE #NewStuff
END


, - ,
, . , Liberty BASIC
, . .
INPUT
OUTPUT, :
"A:\STUFF.TXT" FOR INPUT AS ^Retrieve
INPUT :
I INRUT ttFileHandle, Variable$
#FileHandle , OPEN, a V a r i a b l e s , , ,
.
, ,
, :
'OPEN "A:\STUFF.TXT" FOR OUTPUT AS #myfile
; INPUT "What is your name "; Name$ .
!
PRINT ftmyf ile, Name$

13.

155

CLOSE tmyfile' '


OPEN "A:\STUFF.TXT" FOR INPUT AS #file2
LINE INPUT #file2, YourNameS
PRINT "This is the name you stored in the text file
- "5; YourName$
CLOSE #file2

(" .

END

INPUT ,
. ,
EOF ( End-OfFile ).
, , , , :
.OPEN "A:\STUFF.TXT" FOR OUTPUT AS t u f o
PRINT tufo, "Isn't this exciting?"
PRINT tufo, "Another line bites the dust."
PRINT tufo, "The last line in the text f i l e . "
CLOSE *ufo
OPEN "A:\STUFF.TXT" FOR INPUT AS tbigfoot
1 = 1
WHILE EOF(ftbigfoot)
LINE INPUT tbigfoot, OneLine$
PRINT OneLiiie$
WEKD
CLOSE tbigfoot
END
WHILE WEND ;
10, " ".
:
'OPEN "A:\STUFF.TXT" FOR INPUT AS tbigfoot
I WHILE EOF{tbigfoot) = 0
INPUT tbigfoot, OneLine$
PRINT OneLine$
1 = 1 + 1

! 'WEND
;CLOSE tbigfoot
.

156

1.


STUFF.TXT, tbigfoot .

2.

I
1.

3.

WHILE WEND,
tbigfoot. EOF
.

III. ...

4.


#bigfoot OneLine$.
INPUT .

5.

OneLine$.

6.

I
.

7.

WHILE WEND.

8.


tbigfoot.

Coxftattetiue ,
$[*
,
,
; ,
.
.
() .

. , ,
( ),
. . , , ,
, .
. 13.1.
.


, , ,
. .
S , , .
/ .
, 15 ,
2.
, , , , FIELD, :

13.

157

; FIELD #Filehandle, X AS nameS, Y AS age


Liberty BASIC : , ; X , Y.
FIELD, , ,
, OPEN,
^ :_
iOPEN "_" FOR RANDOM AS #FileHandle LEN = Size

Joe Smith
38
555-1234

Joe Smith
38
555-1234

Carol Hanson
27
555-6000

Carol Hanson
27
555-6000

Doug Bentley
45
555-0001

Doug Bentley
45
555-0001

June Davidson
23
555-1002

June Davidson
23
555-1002

Donald Soons
32
555-5533

Donald Soons
32
555-5533

Jan Davis
31
555-4444

Jan Davis
31
555-4444

. 13.1.
;
.
1.

OPEN (, TRASH.DAT
C:\WINDOWS\TRASH.DAT).

2.

158

FOR RANDOM ,
.

III. ...

3.

#FileHandle , , .
, Liberty BASIC
.
4. LEN = Size ,
. ( ,
, .)
, TRASH.DAT,
, (15 ) (2 ),
:
:OPEN "A:\TRASH.DAT" FOR RANDOM AS ^garbage LEN

= 17


TRASH.DAT , ^garbage
17 .

, OPEN ,
CLOSE .
, .


, , .
:

- --

, PUT #Filehandle, _

ttFilehandle ,
OPEN, _ ,
. ( 1 , 2
..)
, :
iOPEN " a : \ s t u f f . d a t " FOR random AS Closers"LEN - 25
[.FIELD fllosers, 15 AS name$, 2 AS age$, 8 AS phone$
I FOR I =1 TO 3
PROMPT "Type a name:"; name$
PROMPT "What is this person's age?"; age$
PROMPT "What is this person's phone number:"; phoneS
PUT Closers, I
NEXT I
CLOSE

END

ttlosers

, Liberty BASIC,
.
1.

STUFF.DAT , ttlosers 25 .

13.

159

2.

#losers. , (15 ), (2 ) ( 8 ). 25 .

3. FOR NEXT
.
4.

,
, .

5. PUT ,
, ,
# losers. FOR NEXT
I , ,
1. FOR NEXT
I , , 2, ..
6. FOR NEXT.
7.
ttlosers.

8.

.
, .
,
STUFF.DAT, ;
, , .


,
:
GET #Filehandle,
ttFilehandle ,
OPEN, _ ,
. ( 1 , 2
..)
,
:
OPEN " a : \ s t u f f . d a t " FOR random AS tlosers LEN - 25"
FIELD tlosers, 15 AS name$, 2 AS age$, 8 AS phone$
FOR I =1 TO 3
GET ftlosers, I
PROMPT "Name = "; name$

PROMPT "Age = "; age$


PROMPT "Phone = "; phone?
PRINT

NEXT

CLOSE tflosers
END

160

III. ...

"
" , , STQFF.DAT, .
1.

STUFF.DAT , #losers
25 .

2.

ttlosers. , (15 ), (2 )
( 8 ). 25 .

3.

FOR NEXT
.

4.

GET ,
,
# losers. FOR NEXT
I , ,
1. FOR NEXT
I , , 2, ..

5.

GET
.

6. FOR NEXT.
7.


ttlosera.

8.

. ,
Liberty BASIC, ,
, :
JOPEN " a : \ s t u f f . d a t " FOR .random AS ftlosers LEN - 25
A F I E L D fllosers, 15 AS name$, 2 AS age$, 8 AS phone$
PROMPT "What record do you want to retrieve data from?"; recordnum
GET Closers, recordnum
PROMPT "Name = "; name$
ROMPT "Age = "; age$
PROMPT "Phone ~ "; phone?
PRINT
:LOSE
ftlosers
ND
__


, ,
. , . , : \. Windows, -

13.

161

C : \ W i n d o w s . , , . 13,2.
, ,
Windows. - ,
MS DOS, . Windows
, Windows ,
.

7J.Z
() ( )


, , , . , ,
. :
i __ = MKDIR _
_ , , . MKDIR ,
_ . MKDIR
, _ . , TSM.P ( ), ;
1 X = MKDIR " A : \ T E M P "


- , . , , , .

162

III. ...

Windows ( | ); .
Windows ().
.
, :
KILL
_ , ,
. , RAMFILE. SYS TEMP , :
A:\TEMP\RAMFILE.BAS"
KILL "*"
"?". , . :
: KILL " A : \ * . * "

. :
1 KILL " A : \ * . E X E "

, :
=_ = RMDIR _
_ , , . RMDIR ,
_ . RMDIR
, _ . , KITTY , :

>

= RMDIR "A:\KITTY"

13.

163

14


( ...
>
>
>
>

/ V * , . , ,
- .
, .

Windows ,
.. , . .
, , , - .
, ,
, .


, OPEN, , , .
NOMAINWIN
;OPEN "Titlebar text" FOR Window AS #1

:PRINT #1,

; WAIT

"trapclose [quit]"

I [quit]

[CONFIRM "Are you sure that you to quit?"; quit$


I IF quit$ = "no" THEN WAIT
|CLOSE #1
I END

164

III. ...

, Liberty BASIC,
.

1.

Liberty BASIC
.

2,

OPEN FOR WINDOW AS


, ,
#1.

3.

, [label], .
#1, PRINT,
.

4.

WAIT , - .

5.

[label].

6.

Are you
sure that you to quit? ( , ?). Yes () No ().
Yes (), "yes" quits. No (),
"" quits.

7.

, quit?
"". , WAIT , - .

8.

#1.
,
Yes () ,
.

9.

, ,
- .
, OPEN , CLOSE .
, .


, Liberty BASIC
. ,
UpperLeftx UpperLeftY
. ,
225 139
(. 14.1), :
NOMAINWIN
iUpperLeftx - 139

14.

165

-UpperLeftY = 225
;OPEN "Titlebar" FOR Window AS #1
f
PRINT #1, "trapclose [quit]"
WAIT
[quit]
CONFIRM "Are you sure that you to quit?"
quit$
IF quit$ - "no" THEN WAIT
CLOSE #1
I END

NOMAINWIH
JppetLelt';' 22
OPEN "TitlebaL-" FOR BiTidovi A3 f l
PRINT #1, " t L a p j l o s e [ q u i t ] "
UAIT
[quit]
CONFIRM "Ate you sure that you to quit?"; ^uitS
IF -:uiLS = "no" THEN WAIT
CLOSE #1
END

tl'

Puc. 14.1. , , , ,
UpperLeftX UpperLeftY
.
, windowHeight windowWidth
, :
> NOMAINWIN
!UpperLeftX = 139
1
UpperLeftY = 225
:WindowWidht - 550
fwindowHeight = 275
! OPEN "Titlebar" FOR Window AS #1
:
PRINT #1, "trapclose' [quit]"

166

III. .

WAIT
[quit]
CONFIRM "Are you sure that you to quit?";
quit$
IF quit$ - "no" THEN WAIT
CLOSE #1
END
_____

. . _ _ _ _ _

__ - .

-..


OPEN, .


Liberty BASIC BackgroundColorS, .
White ()
Black ()
Lightgray (-) Palegray
(-)
Darkgray (-)
Yellow ()
Brown ()
Blue ()
Cyan ()

Darkblue (-)
Red ()
Darkied (-)
Pink ()
Darkpink (-)
Green ()
Darkgreen (-)
Darkcyan (-)

, , :
NOMAINWIN

UpperLeftX = 139
UpperLeftY - 225
WindowWidht = 550
WindowHeight = 275
BackgroundColor$ = "Pink"
OPEN " " FOR Window AS #1
PRINT ttl, "trapclose [quit]"
WAIT
;[quit]
; CONFIRM "Are you sure that you to quit?";
quit$
1-IF quit$ = "no" THEN WAIT
'CLOSE ttl
! END

3)o3cv(U&ute //0 6
, . MENU, .

S , File (), Edit () Help ()


S , ,
Edit (), Print () Cut ()

14.

167

I ^ , ,
:
; MENU #WindowHandle, " ", "!", [command!]
tfwindowHandle ,
, _ , ! , . , :
i NOMAINWIN

j'MENU #1, "&File", "sopen", [asOpen], "SPrint", [asPrint'

"SExit", fquit]

O P E N "Menu Example" FOR Window AS #1


I PRINT #1, "trapclose [quit]"

, WAIT

i
[quit]
:
CONFIRM "Are you sure that you to quit?";
quitS
I IF quit$ = "no" THEN WAIT
I CLOSE #1
\ END
;

[asOpen]
\ NOTICE "Open command chosen"
- WAIT
[asPrint]
NOTICE "Print command chosen"
WAIT

.
I.

Liberty BASIC
.
,
#1. File () , Open (), Print () Exit ().

, -
, (&)
, &print. , <AIt+O> .
,
, <> [.

168

3.


#1.

4.

,
[label],
.

5.

WAIT ,
- .

. .,.

6.

[ l a b e l ] .

7. Are you sure that


you to quit? ( , ?).
Yes () No ().
Yes (),
"yes" quits. No (),
"" quits.
8.

, quit$ "no". , WAIT , - .

9.

#1. , Yes ()
, .

10. .
. [asOpen]. Open () File (), .
12.
Open command chosen (
). - .
13. [asPrint]. Print () File (), .
14.
Print command chosen (
). - .
(. 14.2)
MENU , :
NOMAINWIN

MENU #1F "SFile", "SOpen", [asOpen], "SPrint", [asPrint "E&xit", (quit]


MENU f1, "SHelp", "sContents", [asContents], "sAbout", [asAbout}
OPEN "Menu Example" FOR Window AS #1
PRINT #1, "trapclose [ q u i t ] "
WAIT
[quit]

CONFIRM "Are you sure that you to quit?";


quit$
IF quit$ = "" THEN WAIT
CLOSE #1
END
[asOpen]
NOTICE "Open command chosen"
WAIT
:

[asPrint]
NOTICE "Print command chosen"
WAIT

; [asContents]

14.

169

NOTICE "Contents command chosen"


WAIT
[asAbout]
NOTICE "About command chosen"
WAIT
, , ,
.

ite Jetp
Open

. 14,2. Liberty BASIC


^^

&


, . Liberty BASIC POPUPMENU:
' POPUPMENU "!",

[label!],

" 2",

[Iabel2]

- ^ POPUPMENU , , (_).
Liberty BASIC , . , :
POPUPMENU__
"!", [labell],
"2", [Iabel2],
"", [Iabel3]
.

170

1.

POPUPMENU
.

2,

!, 2
, .
, 5, 7 15 .

///. ...

3. [ labe 11] [ labe 1 2 ] ,



. , !,
, [labell].

, " | "
, , :
POPUPMENU_
"!, {labell] ,

"", [ label 3]
, .
NOMAINWIN
.' POPUPMENU_
"Destroy the planet", [one],_
"Poison the environment", [two],_
i
"Get elected to political office", [three]
-NOTICE "Nothing selected."
1 END
[one]
|NOTICE "Launching missiles now."
' END

;NOTICE "Spilling oil into the oceans."

:END
,~.

I [three]
NOTICE "Fooled the public once more."

2)<5 6 /&
,
, , .
, .
S
S ,
-/ ,

/
^

14.

171


, Cancel
(). BUTTON:
I BUTTON #windowhandle._, " "/
[branchLabel], UL, xpos, ypos, ,

OifflHl

JtiitlH

[three]
N.-TICB V--.-. 1.c the [-.;
EWE

Puc. 14.3.
,
, .
.
1.

BUTTON
#Windowhandle.

2.

_ .

3. .
4.

[branchLabel] , .

5.

UL ,
. UL, UR ( ), LL ( ), LR
( ).

6.

ypos
Yno .

7.
.

172

III. ...

, . . 14.4.

. 14.4.
,

NOMAINWIN
:WindowHeight = 200
-WindowWidht = 250
;. BUTTON ttmain.mybutton. "E&xit", [quit], LL, 10, 10, 45, 25
j OPEN "Command button example" FOR WINDOW AS #main
PRINT #main, "trapclose [quit]"

;WAIT

i Iquit]
CONFIRM "Are you sure that you to quit?"; quit$
jIF quitS = "no" THEN WAIT
)CLOSE Imain
I END
, Liberty BASIC . BMPBUTTON:
BMPBUTTON #Windowhandle.HMH__KHonKM, "bitmap filename",
[faranchLabel], UL, xpos, ypos
.
1.

BMPBUTTON ttWindowhandle.

2.

_ .

3.

Bitmap filename ,
,

: \Liberty
Basic\face.bmp.

4.

[branchLabel] , .

5.

UL ,
. UL, UR ( ), LL ( ), LR
( ).

6.

xpos ypos
X .

, :

14.

173

NOMAINWINI
WindowWidth =400
BMPBUTTON Smain.picturebtn, "vwsignon.bmp", [Exit], UL, 10, 40
OPEN "BITmap Button Example" -FOR WINDOW AS #main
WAIT
[quit]
CONFIRM "Are you sure that you to quit?";
quits
IF quit$ = "no" THEN WAIT
CLOSE #main
END


,
, . Liberty BASIC ,
, ;

STATICTEXT:

STATICTEXT #windowhandle.staticname, " ", xpos, ypos, j


,

1. STATICTEXT
#Windowhandle. staticname.
2.

,
.

3.

xpos ypos
Yno .

4.
.
PRINT:
PRINT #Windowhandle. staticname, " "
, -:
- NOMAINWIN
.STATICTEXT #main. static, "Old text", 10, 10, 75, 25
; BUTTON #main.mybutton, "Change", [change], LL, 10, 10, 45, 25
i OPEN "Real-life example" FOR Window AS #main
: PRINT #main, "trapclose [quit]"
[change]
. PRINT ttmain. static, "New text"
i WAIT
:

; [quit]

i CONFIRM "Are you sure that you to quit?";


quit?
IF quit$ = "no" -THEN WAIT
CLOSE tmain
END

774

///. .

,
Old text ( ).
Change (), New text ( ).



. ,

(. 14.5).
CHECKBOX:
: CHECKBOX #WIndowhandle.boxname,
; ", [set],

I* IMoieronl conservatism
Radical Bberalism
The ilatus quo
Any*>ng1o benefit foe nch

" - '

[reset], xpos, ypos, width, height

Puc. 14.5. no

.
1.

CHECKBOX ttWindowhandle.

2.

Boxname .

3. , .
4.

[set] , , .
[reset] ,
, .

5.

xpos ypos
.

6.

, . . 14.5.
NOMAINWIN
WindowWidth = 250
WindowHeight = 200
'CHECKBOX
ftl.checkl, "Intolerant conservatism", [set], [reset], 10,
10, 250, 25
CHECKBOX #l.check2, "Radical liberalism", [set], [reset], 10, 40,
250, 25

JCHECKBOX #1.check3, "The status quo", tset],[reset], 10, 70, 250, 25


:CHECKBOX #l.check4, "Anything to benefit the rich", [set],
[reset],
10, 100, 250, 25
^OPEN "Vote for one or more" FOR Window AS 41
SPRINT #1, "trapclose [quit]"
; WAIT

[set]
:NOTICE "Are you sure live in a democracy?"
WAIT

14,

175

I (reset)

I NOTICE "Good move!"


j WAIT

'. [quit]

.'CONFIRM "Are you sure that you to quit?";


quit$
:
IF quit$ - "no" THEN WAIT
CLOSE #1
' END
set ( )
reset ( ). :
PRINT #1.cboxname, "Value?"
.INPUT #1.cboxname, result$
PRINT cboxname, INPUT result$.


, , . RADIOBUTTON, CHECKBOX, :
RADIOBUTTON
fWindowhandle.radioname,
"
[set], [reset] , xpos, ypos, width, height

", -

,
( . 14.6).
Check radio button 1 ( 1) .
NOMAINWIN
WindowWidth = 250
WindowHeight - 200
RADIOBUTTON tl.radiol, "Intolerant conservatism", [set], [reset], 10,
10, 250, 25
RADIOBUTTON #l.radio2, "Radical liberalism", [set], [reset], 10, 40,
250, 25
RADIOBUTTON fl.radio3, "The status quo", [set], [reset], 10, 70, 250,
25
RADIOBUTTON #1.radio4,
"Anything to benefit the rich",
[set],
![reset], 10, 100, 250, 25
:BUTTON #l.bittonl, "Check radio button 1", [test], LL, 50, 3
!OPEN "Vote for one or more" FOR Window AS #1
:
PRINT #1, "trapclose [quit]"

; WAIT

[test]
PRINT #l.radiol, "Value?"
; INPUT n.radiol, testS
.NOTICE "The value of radio button 1 is "; testS

176

III. ...

WAIT

[quit]
CONFIRM "Are you sure that you to quit?";
quit$
IF quit$ - "no" THEN WAIT CLOSE #1
END
set ( ) reset
( ).
:
.PRINT #l.radiobuttonname, "Value?"
|INPUT #l.radiobuttonname, result$
PRINT
radiobuttonname, INPUT result$.


,
. :
| TEXT BOX tWinciowhandle. textboxname, xpos, ypos, width, height

.
1.


tWindowhandle.

2.

Textboxname .

3.

xpos ypos
XVL .

4.

, PRINT, , ,
, :
PRINT #1.textl, " t e x t l . "

:
:PRIKT #1.textl, "[contents?"
:
INPUT $1.textl, stuff$
, ,
, ,
Notice.

14.

777

'. NOMAINWIN
WihdowWidth = 250
WindowHeight = 200
,TEXTBOX tfl.textl, 25,25,200,100
MENU #1, "SOptions", ."Clear text box", [clear],
"sDisplay text from text box", [display],
"E&xit", [quitj
OPEN "Text box example" FOR Window AS #1
;
:

PRINT ttl.textl, "Initial text."

PRINT #1, "trapclose" [quit]"


WAIT
[clear]
PRINT #l.textl, ""
WAIT

[display]
PRINT tfl.textl,- "Icontents?"
INPUT tl.textl, stuffS
NOTICE "Text in text box = " + stuffS
WAIT
[quit]
CONFIRM "Are you sure that you to quit?"; quit$
IF quitS - "no" THEN WAIT
CLOSE #1
END


, . , , . ,
,
, - ( , ).
LISTBOX, :
LISTBOX #Windowhandle.listboxname,
.

array$

[action],

xpos,

ypos,

.
1.

LISTBOX
#Windowhandle.

2.

Listboxnarne .

3. $ , ,
.

178

4.

[action] ,
.

5.

xpos ypos
\\ Yno .

6.

III. ...

, .
,
, :
PRINT ^handle.listboxname, "singleclickselect"

listboxname .
, :
PRINT ttl.listboxl,
INPUT fll.listbcxl.
, ,
, . 14.6.
, ,
. ,
:
[PRINT

ttl.listl,

"singleclickselect"

,
.
|NOMAINWIM
:
arrayS(0) = "Mystery meat"
jarrayS(1) = "Cat food"
'array$(2) = " Something pink and artificially preserved"
s array$(3) = " Liquid mush"
iarray$(4) = "Sugar and artificial coloring"
; WindowWidth = 380
''. WindowHeidht = 240
' LI3TBOX #l.listl, arrays<), [Actionl], 40, 10, 300, 70 >
LISTBOX #l.list2, array&(), [Actionl], 40, 100, 300, 90
,OPEN "Here are your choices for dinner tonight" FOR Window AS #1
jPRINT #l.listl, "singleclickselect"
iPRINT #1, "trapclose [quit]"
WAIT
[Actionl]
PRINT #l.listl, "selection?"
;
INPUT n.listl, selected$
:NOTICE "You chose = + selected$
i WAIT
:

[Action.2]'
!PRINT #l.list2, "selection?"
INPUT #1.Iist2r selected$
NOTICE "You chose = " + selected$
WAIT
[quit]
CONFIRM "Are you sure that you to quit?";
quit$
IF quit$ * "no" WAIT
CLOSE #1
END

14.

179

Puc. 14.6.


,
. , , . 14.7.
,
LISTBOX:

ttWindowhandle.comboboxname,
width, height

array$

[action], xpos, ypos,

-rsySI!
crayS [;

v||.OF,-,4
EEK "HP
PKIMT #1,

. 14.7.

180

III. .

, , , :
PRINT ttl.conboboxl, "selection?"
INPUT ttl.comboboxl, selected$
, :
;NOMAINWIN
=" array?(0)
array$(1)
array$(2)
array${3)
array$(4)

= "Mystery meat"
= "Cat food"
= " Something pink and artificially preserved"
= " Liquid mush"
= "Sugar and artificial coloring"

WindowWidth = 300
WindowHeidht = 240
COMBOBOX #l.combol, array$(, [Action], 40, 50, 216, 100
OPEN "Here are your choices for dinner tonight" FOR WINDOW AS II
PRINT #1, "trapclose [quit]"
WAIT
[Action]
PRINT ftl.combol, "selection?"
INPUT tfl.combol, selected$
NOTICE "You chose = " + selected?
WAIT
[quit]
CONFIRM "Are you sure that you to quit?"; quit$
IF quit$ = "no" THEN WAIT
CLOSE #1
END


, ,
. 14.8. ,
, .
:
:
GROUPBOX tWindowhandle, "Groupbox text", xpos, ypos, ,
,
:
NOMAINWIN
WindowWidth = 250
WindowHeidht = 200
GROUPBOX #1, "Your choices are", 5, 5, 225, 120
'RADIOBUTTON #l.radio2, "Radical liberalism", [set], [reset], 10, 30,
150,

15

RADIOBUTTON #l.radio3, "The status quo", [set], [reset], 10, 60, 150, .
15

^RADIOBUTTON ftl.radio4, "Anything to benefit the rich",


[reset], 10, 90, 150, 15
:BUTTON ftl.buttonl, "Exit program", [quit], LL, 50, 1

14.

[set],

181

OPEN "Vote for one or more" FOR WINDOW AS #1


PRINT #1, "trapclose [quit]"
WAIT

[set]
MlT
[quit]
CONFIRM "Are you ,sure that you to quit?";
quit$
IF quit$ - "no" THEN WAIT
CLOSE fl
END
.^ . m l xi
Your choicas ore
<~ Bodice! liberalism
The Btmui quo
f * 01 benefit ie i

Puc. 14.8.
,

182

III. .

15

>
>
>
>

2J

/ L ,
. , .
, , .
.
: " ". , .
, . , ,
Liberty BASIC ( ) , . .

ouiuJtcu
.
| V . , (, PRINT PRRINT)

.
(, ,
)
S . , , .


, ( ), , .
PRINT , Liberty BASIC ,
. . Liberty BASIC , , (. 15.1).

15.

183

,
, . , .
, .
:
PROMPT "How many times do I need to tell you no"; Answeer?
:PRINT "Your reply - "; Answer$
; END

I
' Liberty BASIC vZOI ! - eta***

r.omainwin
iiinnelp . I b 2 u v . h l p

BAStC Compile Hated Unfinished Sfrng

. 15.1. Liberty BASIC ,



: "How many times do I need
to t e l l you no? (" ?")".
Answeer$
( Answer?, ). Liberty BASIC
AnsweerS Answer$ , Answer$
. , ,
, .
,
. Liberty BASIC
Answer? answer$, "", .
. , . ! , ,
, .

184

III. ...

Mariner 1
, .
, , . , ,
.
1982 NASA (National Aeronautics and Space Administration
no )
. , ,
, NASA . - , FOR NEXT
FOR I - 1, 3


FOR 1 = 1. 3.

, .
, / 1.3.
NASA , , .
. ,
, . , , , , , , , ,
, , .


, .
,
(, , , ). ,
, ,
.
, , , -. -
, (-) , .
,
.
, -
.
- Therac-25
Therac-25 , ,
. ,
, . .
Therac-25 . , ,
, Therac-25 . no- j
, ]

15.

185

,
. .
, ,
. | . , , .
, ,
(, 60 000). .
(, 9 489). , .


, ,
. . . , .
,
. , ,
,
. , , ,
-.
- , ,
Liberty BASIC .
.
.
Sheffield
. , , , .
;
. Sheffield - ;
. j
, , , "" .
'" , - , , .
,
. , Sheffield,
"". .



. , .
- , ,
.
Liberty BASIC , .

186

1.

, .

2.

Run^Dedug (^) Liberty BASIC ( <AIt+F5>).

III. ...

Debugging (), . 15.2. , .


Step (),
Step () Liberty BASIC
.
1 '' Debugging

-Inlxi

Ed!

BackgroundColc r S - 'buttonface'

- 8192

Com

CommandLineS
count
DefaultDirS
DiaplayHeight

- 0

- 'c:\lb201w'

"

- 768

stepjsaUk! fiiai Top

*
TManually scroll variables

-.

^.

' dra some

dia colors i
colors (1) =
colors ( 2 ) =
color? (3) =
colors ( 4 ] =
colors (51 *
colocSlfi] =

H
I

-}\

"red"
"brown"
"yellow"

"green"

"blue"
"darkpink"

count = 1. . ...

__ .,,.....

. 15.2. Debugging
Walk ( ), Liberty
BASIC . .
Run (), Liberty BASIC , . , Step (). , . , .
,, , PRINT . , :
!PRINT totalamount
totalamount = (totalamount *salestax) + totalamount
i PRINT totalamount
PRINT
totalamount . PRINT totalamount . totalamount PRINT , , PRINT.


, , .
, .

15.

187

.
1.

, .

2.

TRACE , .

3.

TRASE
.
TRASE 0 . , Step (), Walk ( ) Run
() Debugging ().
TRASE 1 . .
Walk ( )
Debugging ()..
TRASE 2 . Run
() Debugging ().
Run<>Debug (^) Liberty
BASIC ( <Alt+F5>).

Debugging ().
4. Walk ( ).
Liberty BASIC
, TRASE 0. TRASE 0. .
Step (). , Walk ( ) Run ().
TRASE . .
TRASE. TRASE , .

188

III. ...

IV

9>

H06WU

V4pOUjiu.Op .

V\0*>&OAfti>*

Hi

/3
,
. ,
, .

. ,
.
. , ,
| . .

16


&> .,.
>
>
>
>

L/

/\* ,
, _, _ .
, , .
. , ,
,
:
;Namel$
!.Name2$
!Name3$
|Name4$

=
=
=

"Patrick
"Jordan
"Michael
"Bo the

DeGuire"
Preston Wang"
Elizondo "
Cat"

, . , . (
. 16.1).
DIM MyArray(5)AS STRING
(1)

MyArray(2)

()

(4)

MyArray(5)

. 16.1.

,
. , .
,
. , -

16.

191

, ,
. , . DIM:
;DIM ArrayName (Number)
ArrayName , a Number , .
, , .
, ,
($) :
DIM ArrayName$ (Number)
.

I -S
| ^ .
,
| S , . ( .) , ,
. C/C++,
Java Visual Basic.NET
, Liberty BASIC Pascal, - j
, . , Liberty BASIC :
DIM AgeArray{3)
Liberty BASIC AgeArray : ]
AgeArray (1), AgeArray ( 2 ) A g e A r r a y ( 3 ) .

C/C++, Java Visual Basrc.NET


, . ,
:
int agearray(3)
: int agearray ( 0 ) ,
int agearray {1} int agearray (2), , .
C/C++, Java
Visual Basic.NET, . .
:
I DIM CatArray$ ( 4 5 )

, 45 ,
CatArray? (1} CatArray$ ( 4 5 ) .

192

IV.

/ ( }

.
, , .
, , :
93 , :
iMyVariable = 93
- , , , . , :
; iQArray(3) = 93
93
IQArray.
,
, Liberty BASIC
.
, :
;

YourlQ = IQArray (3)

IQArray 93, YourlQ


93.
.
, .
,
( ) , :
NameArray(l) = "Mike Ross"
-NameArray(2) = "Bill McPherson"
;NameArray(3) = "John Smith"
,
WHILE-WEND FOR NEXT, :
;

F O R I = 1 3

NuinberArray(I) = 125
INEXT I
FOR NEXT 125 ,
NumberArray.
, ( ), :
DIN Name Array$(3)
.FOR I - 1 TO 3

16.

193

PROMPT "Type the name of someone you hate:"; EnemyS


NameArrayS (I) ~ Enemy$
NEXT I
FOR I + 1 TO 3
PRINT NameArray$(I) + " sound like the name of a moron."
NEXT I
END
, .
1.

NameArray,
.

2. FOR NEXT,
.
3.

Prompt, . EnemyS.

4.

,
Enemy$ NameArray. , FOR NEXT, EnemyS NameArray ( 1 ) . EnemyS NameArray ( 2 ) .
, EnemyS
NameArray ( 3 ) .

5.

FOR NEXT,

6.

FOR NEXT,
.

7.

NameArray, :
sound like the name of a moron, ( .).
,
NameArray$ ( 1 ) , ,
NameArray ( 2 ) ,

NameArray ( 3 ) .

8. FOR NEXT.
9.

, .


,
:
;DIM PetArrayS(5)

, (. . 16.1).
, , . , :
DIM ArrayName(X)

754

IV.

Liberty BASIC , .
:
|DIM ArrayName{X, Y)
, . 16.2.
:
! DIM VictimArraydQ, 9) AS STRING
, 90
(10x9), .
DIM TwoD (2,3) AS STRING

TwoD(1,1)

TwoD (2,1)

TwoD (1,2)

TwoD (2,2)

TwoD (1,3)

TwoD (2,3)

. 16.2.
Liberty BASIC . . (, Visual
Basic) , .
( . 16.3):
|DIM ArrayName<X, Y,
,
, .
, , :
. D I M VictimArray${2, 3) AS STRING'
= F O R I = 1 TO 2
FOR J - 1 TO 3

PROMPT "Who do you want to hurt";


Enemy$
VictimArray$(I, J) = Enemy?
NEXT J
NEXT I
PROMPT "Type X location of the array item that you want to print,
such as 1"; X
PROMPT "Type Y location of the array item that you want to print,
such as I"; Y

16.

195

PRINT victimArray?(X, Y) + "deserves to be hurt the most,"


END
DIM ThreeD (X, Y, Z) AS INTEGER
-zn

. 16.3.
. , :
;Mike Ross
I Bill McPherson
:Jon Markey
j.Bobby Lee -.
JTom Clark
IRoger Smith
, :
TVictimArraySU,
1 victimArraySd,
|VictiraArray$(1,
! VictimArray$(2,
| VictimArray$(2,
j VictimArray$(2,

1}
2}
3)
1)
2)
3}

=
=
=
=
=
=

Mike Ross
Bill McPherson
Jon Markey
Bobby Lee
Tom Clark
Roger Smith

"Type X and Y location of the array


item that you want to print, such as 1, 3" 2,1, :
'"Bobby Lee deserves to be hurt the most."
-
, .

196

IV.



. .
.

( )
,
, .
( ), .
,
. , .
(
BASIC GW-BASIC), Liberty BASIC . ,
. ,
REDIM, :
REDIM VictimArray$(44)
VictimArrayS , 44 .
Liberty BASIC
.
,
. , .
.
, ,
:
DIM LoserArray$(3)
FOR I = 1 TO 3
PROMPT "Who is incompetent?"; MyBoss$
LoserArrayS(I) = MyBoss$
NEXT I
FOR J - 1 TO 3
PRINT LoserArray$(J)
NEXT J
REDIM LoserArray$(7)
LoserArrayS C?) = "Bobby Lee"
PRINT LoserArray$(7) + " is a pathetic character,"
END

16.

197

, .
1.

LoserArray,
.

2.

FOR NEXT,
.

3.

Prompt, Who is incompetent? (


?).
MyBoss$.

4.

MyBossS LoserArray.

5.

FOR NEXT.

6.

FOR NEXT,
.

7.

LoserArray.
FOR NEXT , ,
.
LoserArray .

8. FOR NEXT.
9.

LoserArray ,
(7) .

10. Bobby Lee


LoserArray.
11.

LoserArray ( 7 ) , Bobby Lee, is a pathetic character, (


.). Bobby
Lee is a pathetic character. (
.).
12. .
, . , .

198

IV.

17



& uafa...
>
>
>

(
) .
, .
-
( 16), , .
~ ,
( ).
, .
. .
. ,
,
( ), , :
;

Namel$ = " Katz"

' Addressl$ = "123 Main Street"


Phonel$ = "555-1234"
Salaryl = 55000
Name2$ = "Roger Wilco"
Address2$ = "948 Manchester Road"
Phone2$ = "555-4587"
Salary2 - 29000
, ,
. , ,
.
. , , , .
/

Liberty BASIC .
, QBASIC. . .

17.

199


.
, ,
, :
-- TYPE RecordName
FullName AS STRING * 15
Address AS STRING * 25
Phone AS STRING * 14
Salary AS SINGLE
fEND TYPE
.
I.

RecordName".

2.

FullName,
15 .

3.

Address,
25 .

4.

Phone, 14 .

5.

Salary, .

6.


RecordName".

"

"

, .
, .
, , .
, .
, , ,
, :
TYPE EmployeeRecord
FullName AS STRING-* 15
Address AS STRING * 25
. Phone AS STRING * 14
Salary AS SINGLE
END TYPE
DIM Workers AS EmployeeRecord
DIM ; "
Workers, , EmployeeRecord".
, , ,
.

200

IV.


, .

s ,
/ ,


( ) , :
I'RecordVariable. Variable = Data
, :
'TYPE Bomberlnfo
NickName AS STRING * 16
MissijnsFlown AS INTEGER
Crew AS INTEGER
END TYPE
, , :
.DIM B17 AS Bomberlnfo
NickName, :
;

--

;17.NickName = "Brennan's Circus"

: " 17
Brennan NickName".


:
_-------
--
Variable = RecordVariable.Variable
, :
TYPE Bomberlnfo
NickName AS STRING * 15
MissijnsFlown AS INTEGER
Crew AS INTEGER
END TYPE
" DIM B24 AS Boraberlnfo

*
- .
( }
:

77.

201

struct bomberinfo {
char nickname[15]
int missionsflown
int crew
} B24;
bomber info.
bomberinf , 15 , missionsf lown crew. ,
24, .
24 , :
GetName = B24.NickName
'. GetHistory = 24. MissijnsFlown
[ GetCrew = B24.Crew


,
,
, , .
, , , :
DIM Array-Name (Number) AS RecordType 16.

, :
TYPE GulliblePeople
FullName AS STRING * 15
CashAvailable AS SINGLE
END TYPE
DIM PoterntialVictims{3) AS GuliiblePeople

, .
1.

GulliblePeople.

2.

FullName,
!5 .

3.

CashAvailable,
.

4.
5.

GulliblePeople.
, ,
GulliblePeople. (
, 16, . 16.1.)

, QBASIC. .

202

IV.

TYPE GulliblePeople
FullName AS STRING * 15
CashAvailable AS SINGLE
E$D TYPE
DIM PotemtialVictims{2) AS GulliblePeople

FOR I * 1 TO 2
PRINT "Type the name of someone you want to con;"
INPUT PotemtialVictims(I).FullName
PRINT "How much money do think you can get?"
INPUT PotemtialVictims(I).CashAvailable
NEXT I
PRINT
PRINT "Here is your list of future con victims:"
FOR I = 1 TO 2
PRINT PotemtialVictims(I).FullName
PRINT PotemtialVictimsCI).CashAvailable
NEXT I
END

L_

~.

, .
PotemtialVictims (I) .FullName, PotemtialVictims ( I ) .CashAvailable. PotemtialVictims ( 2 ) . FullName,
PotemtialVictims ( 2 ) . C a s h A v a i l a b l e .

17.

203

18


& ...
>
>
>
>

77~

^/ g,

.
, . , ,
.
.
, . , ,
, ,
.
, BASIC,
. Liberty BASIC,
.
, Java C/C++.

,
. , , . .
, , .
,
. , , , , . 18.1. ,
, .
.
,
, , .

204

IV.

Tom

Dick

Dick

Harry

John

j^

>

Harry

John

Tom

DIM NameArray{4) AS STRING

5. /.
, ,
, ,
, ( ), , . 18.2.

. 18.2. ,

, (nil) .
,
, . , . 18.3.
, , . , ,
.

18.

205

Tom

Dick

Harry

Tom

Dick

Harry

nil
A

. 18.3.
C/C++.
, , C/C++, .
,
. (
) , ,
.


, .
| S
| S
Liberty BASIC ,
Pascal,
, .
, , Pascal, , ,
, , .

206

IV.

Pascal, , :

: TYPE
PointerName = 'RecordType;
PointerName.
,
RecordType.
. , s t r i n g FullName
Address, Next pointer:
TYPE
PointerName = A RecordType;
RecordType.= RECORD
FullName : string[15];
Address : string[25];
Next : PointerNaine;

- END

, , . , :

VAR
Node

PointerName;

, :
PROGRAM LinkedLists;
) TYPE
PointerName = ^RecordType;
RecordType = RECORD
FullName : string[15];
Address : string[25];
Next : PointerName;
END
VAR

Node : PointerName;
, Pascal, .
1.

, LinkedLists.

2.

, TYPE, , .

3.

PointerName,
RecordType.

4.

RecordType.

5.


FullName, 15 .

6.


Address, 25 .

18.

207

7.

Next,
RecordType.

8.


RecordType.

9.

, VAR,
, .

10. Node,
RecordType. ( .)
, - . ,
, , .


, , , ,
. , . 18.4.
1.

2.

3.

,
.

1.

2.

3.

Dick

Harry

. 18.4.

208

IV.

, Pascal , :
PROGRAM LinkedLists;
. TYPE
PointerName = ^RecordType;
RecordType = RECORD
FullNarae : string[15];
Address : string[25];
Next : PointerNarne;
END

: VAR

Node : PointerKarne;
BEGIN
New(Node);
Node A .FullName : = 'Jonathan Blake';
Node"-.Address := '837 Dead-End Avenue' ;
Node' 4 .Next := nil;
; END.
BEGIN .
,
BEGIN, " ".
1.

, BEGIN, , .
2. . .
3. Jonathan Blake
Fullname .
4.
5.

837 Dead-Snd Avenue


Address .
nil Next.
, , , . nil , - .
, Node' 4 . Next .


, -
, .
,
. , "", . 18.5.
.
1.

, , .
2. , , .

18.

209

. 18.6.

Dick

Harry

John

Harry

John

. IS. 5.
" "

Dick

Harry

nil

. 18.6. " ",

210

IV.

,
, . , , , . ,
,
,
, , , .

c&fuffctfiijfi
,
;
(. . 18.2).
,
.
, . , . 18.2,
( Dick), ,
Harry. , Dick.
,
,
.

. , , ( ).
, ,
, .
, ,
. ,
, . .
^
. , ;
, .


,
, .
, . , , . 18.7.

"" ,
.

18,

211

Tom

Dick

Harry

. 18.7.
, ,
,
, - .
,
.


, (. . 18.7). ,
, . 18.8.

Dick

Harry

. 18.8. ,
, . , .

,
. : , .

(Reverse Polish Notation RPN), . , (1+2) '3, ,
:

:1 2 + 3 *

212

IV.

: (1 + 2)*3
: 12 + 3*

. 18.9.
. 18.9 ,
(1+2) *3 .
.
1.

1 .

2. 2 , 1 .
3.

2 , I.
, 3,
.

4.

3 , , 3, .

5.

3 , 3.
,
9, .

LIFO (Last In First Out, .. ). , , , .


, . , , , .

, .
, . , .
FIFO (First In First Out, .. ). , ,
,
(, 18.10).

18.

213

Tom

Dick

Harry

John

Dick

Harry

Tom

Tom

Dick

Tom

Dick

Mike

. IS. 10. ,
, . 18.10.
1.

, John , Harry , Dick , .

2.

John.
.

3.

Harry.
.

4.

Mike.
, .

.
, ,
() , () ,
. 18.11.

214

IV.

. 18.11.
,
. ,
, .
, . , , , - ( J) . - ( 2)
, - ( 3) ..

,
, , . . 18.12 .
,
, .
, , .
, , ,
.
, ,
.

18,

215

. 18.12.

216

IV.

19

3tfa>u ...
>
>
>
>

\^ - (,
, ) , .



"- ".
Liberty BASIC - ,
, ,
. BASIC
, Microsoft -
Visual Basic. , , BASIC, Visual Basic Visual Basic For
Dummies ( IDG Books Worldwide, Inc.).
,

nftotftoMMHOto

, ,
, . , ,
. , ,
. , , -

19. - 217

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

tfnftocrflurfib

nftotftauui

" ", , ,
. , . , - . , , . , ,
, .

, , , , , ,
. ,
, ,
.

, .

.
! . , ( ).
, , , , ,
. 19.1.

, .
, , , , , . 19.2.

218

IV,

. 19.1.

\
\

. 19.2.
,

19. - 219

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

/>/

, ,
, , , .
,
, .
1 s ( )
-/ ( )

, .

. ,
, , .
</
, () . , , .

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

220

IV.

. 19.3. -


,
. ,
. , .
( ) , .

5
-1
, . -1
.
. , , . , , .

. , , . , "" ,
.

19, - 221

, . !
, .
,
, 300 . , , .
- . - , , ,
, .
, ,
. , , - , , . , .
( ), , , , . ,
,
. ? , , ,
.
- ,
. , ,
, . , . ,
, .


, . ( 17, "
".) . ,
, .
Liberty BASIC ,
C++. C++; ,
, .
C++:
= Class monster

public:
int x_cooi:dinate:
int y__coordinate;
void moverne(int, i n t } ;
void i n i t i a l i z e t i n t , i n t ) ;
1=

222

IV.


,
: , .
,
. . (
.)
, . ,
,
:
, . .
C++ .
1.

,
monster.
2. .
3. ,
, , .
4. x_coordinate
integer.
5. y_coordinate integer.
6. ,
() moveme, integer.
7. ,
() initialize, integer.
8. .
.
, .


, ,
, . :
Class monster
f
public:
int x_coordinatei
int coordinate;

19. - 223

void movemefint, int);


void initialize(int, int);
moveme initialize.
- , , :
'void monster::moveme(int new_x, int new_y)

!{

l x_coordinate = x coordinate + new_x;


y_coordinate = y_coordinate + new_y;
void monster::initialixe{int init_x, int init_y)
x_coordinate - init_x;
coordinate = init y;
i n i t i a l i z e ,
monster. moveme
" ( ) Y ( ).


,
, , . - .
, .
zombie,
monster;
^include <iostrem.h>
;class monster
public:
int x_coordinate:
int y__coordinate;
void moveme{int, int);
void initialize{int, int);
void monster: :moveme{int new__x, int new_y)
x_coordinate = x_coordinate 4 new_x;
y_coordinate = y^coordinate 4 new_y;
void monster::initialixe{int init_x, int init_y)
x_coordinate *= init_x;
- y_coordinate = init_y;
|1
I void main{)
I monster zombie;
zombie.initialize{12, 15);
cout "The X-location of the zombie is "

224

IV,

zombie.x_coordinate "\n";
cout "The 'Y-location of the zombie is " <
zombie.y_coordinate "\n";
zombie,.moveme (34, 9) ;
cout "The new X-location of the zombie is
zombie.x__coordinate "\n";
cout "The new Y-location of the zombie is
zombie. .coordinate "\n";
, C++, void
main ( ) . .
1.

, ,
C++.

2.

,
.

3.

zombie
monster.

4.

i n i t i a l i z e ,
zombie (12 15 ).

5.

The x-location
of the zoirbie is ( ) 12.

6.

The Y-location
of the zombie is ( Y ) 15.

7.

moveme, zombie 34 Xv\ 9 Y.

8.

The new Xlocation of the zombie is (


) 46.

9. The new Y-location


of the zombie is ( Y ) 24.
10. C++.
, , C++, , .
S
S ,

,
- , - .
Liberty BASIC - , . .

19. - 225

/ -
S -

-
, - ,
Pascal
( Delphi), BASIC ( Visual Basic) C++.
-
- ,
, , , , , .
,
- ( ,
, ). ]
- -1
, .
| S
S
,
S ,

/ ,

, , - (Pascal,
BASIC C++), . , , , "" .
, , -
, , . , , ; , .
,
. -
| S SmallTalk,
| ^ Eiffel,

226

IV,

s #,
S Java.

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

19. - 227

:
,

&...
, ,
, ,
. , ,
, - ,
.
^ , , .
. (),
.
, , .

20

& ...
>
>

(, , ), , , , .

,
. ( 1619.) , .
, , , . ,
, , .
.
, . , , , . ,
, 15 .

(
). , .
Liberty BASIC ,
.
^J

,
, .
, , , .
|


" ".


" ". " "
- {, ),
, .
, , . " " -

20.

231

0(), " " (order of


magnitude), .
, " " , , . , () N2+N+1, "

" (N2).

" "
, ( N2), . (,
, ' " .)
" "
.
, . .
,
" ", ,
.

&
, .
, - .

. . ,
(. 20.1). .

232

1.

, .

2.

,
.

3.

. 2
, .

V. : ,

15

78

29

16

15

78

29

16

15

78

29

16

15

29

78

16

15

16

29

78

. 20.1.
, :

MaxSize = 5

REDIM MyArray(MaxSize)
FOR I = 1 MaxSize
MyArrya(I) = INT(RND(1) * 100) + 1
PRINT MyArray(I); SPACES(l);
NEXT I
PRINT "(Initial array)"
FOR ArrayPos - 2 TO MaxSize
TempValue = MyArray(ArrayPos)
StopNow = 0
Count = 1
Time2Stop = 0
WHILE (Time2Stop - 0)
IF TempValue ,MyArray(Count) THEN
FOR J = ArrayPos TO Count STEP -1
MyArray(J) = MyArray(J - 1)
NEXT J
MyArray(Count) = TempValue
StopNow 1
FOR'I = 1-TO MaxSize
PRINT MyArray(I}; SPACE$(1);
NEXT I
PRINT
END IF
Count = Count + 1
IF _StOpNow - 1) OR {Count = ArrayPos) THEN
Time2Stop = 1
END IF
WEND
NEXT ArrayPos
FOR,I = 1 TO MaxSize
PRINT MyArray(I); SPACE$(1);

20.

233

NEXT I
PRINT "Sorted array)"
END
:
57 89 77 3 21 (Initial array)
58 77 89 3 21
59 57 77 89 21
60 21 57 77 89
3 21 57 77 89 {Sorted array}
it

, , .
1.

MaxSize, 5;
; ; 1 100 ;
Initial a r r a y
( ).

2. FOR NEXT, ,
ArrayPos.

234

3.

TempValue
, ArrayPos. FOR NEXT
TempValue .

4.

stopNow .
, ,
.

5.

Count
, . , TempValue.

6.

Time2Stop
.
, , .

7.

WHILE WSND, Time2Stop.


, .

8.

IF THEN, TempValue ( , ),
Count.
, .

V. ; ,

9. FOR NEXT,
TempValue.
10. TempValue , Count.
. stopNow , 1.
, TempValue.
12. .
13. IF THEN, .
14. Count.
15. , StopNow , Count
ArrayPos. , Time2Stop
, 1.
16. WHILE WEND,
.
17. FOR NEXT,
.
18. Sorted
array
( ).
19. .

,
"" . , , ,
. 20.2. .
1. .
2. .
3. . 2 ,
.
4. . 13 , .
(. . 20.2).

20.

235

15

78

29

16

15

78

29

16

15

78

29

16

15

29

78

16

15

29

16

78

15

29

16

78

15

29

16

78

15

16

23

78

15

16

29

78

. 20.2.

' , :
MaxSize = 5

REDIM MyArrau(MaxSize}
FOR I = 1 TO MaxSize
MyArryaU) = INT(RND(1) * 100) + 1
PRINT MyArrayd) ; SPACES(l);
NEXT I
PRINT "{Initial array)"
Pass = 1'
Time2Stop - 0
WHILE (Time2Stop) = 0
NoSwap = 1
FOR I = 1 TO (MaxSize - Pass)
IF MyArrayd) > MyArrayd + 1) THEN
TempValue = MyArray(I)
MyArray(I) = MyArrayd + 1)
MyArrayd + 1) = TempValue
NoSwaps = 0
FOR J = 1 TO MaxSize
.PRINT MyArray(J); SPACE${1);

236

V. : ,

NEXT J
PRINT
END IF
NEXT I
IF NoSwapS = 1 THEN
Time2Stop - 1
END IF
WEND
FOR 1 = 1 TO'MaxSize
PRINT MyArray (I); SPACE$(1)
NEXT I
PRINT "(Sorted array)"
END
:
5 19 61 26 27 (Initial array)
5 19 26 61 27
5 19 26 27 61
5 19 26 27 61 (Sorted a r r a y )

,
.

1.

MaxSize, 5; MyArray
; ; 1 100 MyArray;
Initial a r r a y
( ).

2.

Pass 1.

3.

Time2Stop
.

4.

WHILE WEND, Time2Stop.


, .

5.

NoSwap
.

6. FOR NEXT,
(5-Pass) .
, ..
7.


.
IF THEN
MyArray.

8.


M y A r r a y .

9.

NoSwaps
.
, ,
WHILE WEND .

20.

237

10.
.
11. IF THEM,
.
12. FOR NEXT.
13. , IF THEN,
, NoSwap . ,
Time2Stop , 1.
14. WHILE WEMD.
,
Tirae2Stop 1. , .
15. Sorted
array
( ).
16. .

, . ,
,
, .

CoftiHUfto6fca

M&ndqfau

&

, , ,
, .
.
" ".
,
. .
; ( )
.
.

238

1.

. (
. 20.3 , . .)

2.

{ ). ,
. 20.3, - 15 29, . - 16 4, . - 78.

V. : ,

3.

- . (. . 20.3), 4 16 .

15

16

78

29

29

15

16

1 2

16

15

15

78

29

78

16

29

^
15

16

29

78

15

16

29

78

. 20.3.
,
4.

,
. . 20.3 , ; .

5.

. 24 ( ) ,
. ,
16 78
.

, ,
, .
MaxSize = 5
REDIM MyArray(MaxSize)
FOR I = 1 MaxSize
MyArray(I) = INT{RND(1) * 100) -f 1
PRINT MyArray(i); SPACES(1);
NEXT I

20.

239

PRINT " ( I n i t i a l a r r a y ) "


X = INT(MaxSize / 2}
WHILE X > 0
Time2Stop = 0
Limit = MaxSize - X
WHILE (Time2Stop = 0)
Switch *= 0
FOR = 1 TO Limit
IF M y A r r a y ( K ) > MyArray(K + X)
TEMPX - M y A r r a y ( K )
M y A r r a y { K } = M y A r r a y C K -f X)
MyArray!K + X) = TempX
Switch =
END IF
NEXT
- Limit = Switch - X
IF Switch = 0 THEN
Time2Stop - 1
END IF
WEND

THEN

FOR I = 1 TO MaxSize
PRINT M y A r r a y ; S P A C E $ ( 1 ) ;
NEXT I
PRINT
X = I N T f X / 2)
WEND.
FOR I = 1 TO MaxSize
PRINT M y A r r a y ( I ) ; S P A C E $ ( 1 ) ;
NEXT I
PRINT "(Sorted a r r a y ) "
END

:
94 17 70 90 62 (Initial array!
62 17 70 90 94
17 62 70 90 94
17 62 70 90 94 (Sorted array)


, 1, 3 5 (94, 70 62 ).
, 2 4 (17 90 ). .
, ,
.
1.

240

MaxSize, 5; MyArray
; ; I 100 MyArray;
Initial a r r a y
( ).

V. : ,

2.

X
2, .
X 2 (MaxSize/2 = 2), , .

3.

WHILE WEND,
, X .

4.

Time2Stop
.

5.

Limit
MaxSize-x. Limit
M a x S i z e - 2 3.

6.

WHILE WEND, Time2stop. , ,

7.

Switch
.

8. FOR NEXT.
9.


. IF
THEN .

10.
.
11. Switch .
12. IF THEN, .
13. FOR NEXT.
14. Limit Switch-x.
15. , Switch . , Time2Stop
, 1.
16. WHILE WEND.
17.
.
18. X 2 .
, .
19. WHILE WEND.
20. Sorted
array
( ).
21. .

20.

241

. :
, ,
, . 20.4.

73

89

26

62

nb

26

89

73

62

nb

26

62

73

89


~]

. 20.4.
,

, . .
.
1.

',

, . , ,
, , , .
, ,
. 1 ,
.
.

, , . , .

,
. , , :
MaxSize * 5
REDIM (MaxSize)
; FOR I = 1 MaxSize
(I) = INT(RND(1}*10) + 1
PRINT NumArray(I) ; " ";
NEXT I
PRINT "(Initial array"

242

V. : ,

CALL QSort 1, MaxSize


FOR I = 1TO MaxSize
PRINT NumArray(I); "",
NEXT I
PRINT "(Sorted array)"
END
.
1.
2.
3.
4.

,
, .
QSort,
(1) (MaxSize) .

.
.

QSort :
SUB QSort Start, Finish
I Start
J - Finish
X NumArray (INT ((I-t-J/2))
WHILE, I <= J
WHILE NumArray(I) < X
WEND
WHILE NumArray{J) > X
J = J - 1
WEND
IF I < J THEN
A = NumArray(I)
NumArray(I) = NumArray(J)
NumArray(J) = A
j = j ]_
END IF
WEND
FOR = 1 TO Finish
PRINT NumArray(K); "";
NEXT
PRINT
IF J > Start THEN CALL QSort Start, J
IF I < Finish THEN CAKK QSort I, Finish
END SUB

QSort .
1.

(QSort) ,
(Start Finish).

2.

(I J),
start Finish . I j ,
, Start Finish .

20.

243

3.

X,
NuraArray , .

4.

WHILE WEND, , I J.

5.

I , , NumArray, X.

6.

J
, , NumArray,
X.
, , , .

7.

, .

8.

WHILE WEND, .

9.

10. QSort,
.
11. .
:
27 62 5 79 14 {Initial array)
5
5
5
5

62 27 79 14
4 27 79 62
14 27 62 79
14 27 62 79 (Sorted array)

(5). , ,
, 5. 5,
. (27). , , , 27.
79 62.
.

cuiofturiLua
, ,
. , -
, .
, . , .

244

V. ; ,

.
. , -
,
.
.

20.

245

21

&
>
>
>
>

( ), . ,
,
.
^ ,

, .
20.
,
.
. ,
, .


( ).
, . -
, .
. , (,
), .
, . , , . .
, .
, .
. , , ,
Liberty BASIC:
MaxSize = 5
REDIM MyArray(MaxSize)
MyArray(l) = INT(RNDU) * 10) + 1

246

V. : ,

PRINT M y A r r a y ( l ) ; SFACE$(1};
FOR I = 2 TO MaxSize
M y A r r a y ( I ) = MyArrayd - 1) + I N T { R N D 1 ) * 10} +
PRINT M y A r r a y ( I ) ; SPACES<1);
NEXT I
PRINT
INPUT "Which number do you want to find: "; FindMe
Foundlt = 0
FOR J = 1 TO MaxSize
IF Founslt = 0 THEN
PRINT "Checking array location "; J
IF MyArxayfJ) = FindMe THEN
FounDIt 1
END IF
END IF

NEXT J
IF Foundlt = 1 THEN
PRINT "Found it!"
ELSE
PRINT "The number you want is not the list."
END IF
END

, .
1.

MaxSize, , MaxSize 5
MyArray, (
M a x S i z e ) .

2.

, MyArray. , . .

3.

, . FindMe.

4.

Foundlt
0.

5.

MyArray , Findlt.
.

6.


Found it! (!), .
, : The number you want is not the
list. (, , .).

7.

, , .

21.

247

2)
,
. , . ( 20.)
( ) . , , , () (). , ( ).
. 21.1 37 , .
. , . () 30,
(37) .
( )
. 59. 59 , 37,
.
37 45. . ,
. .

37

15

16

29

30

37

45

59

82

93

45

59

82

93

"

37

honcKa

37

45

. 21. 1.
,

, ,
:
= 5
REDIM MyArray (MaxSize)
M y A r r a y ( l ) = I N T ( R N D C l ) * 10) + 1
PRINT M y A r r a y ( l ) ; S P A C E $ ( 1 ) ;
FOR I = 2 TO MaxSize
M y A r r a y ( I ) = M y A r r a y i l - 1) + I N T ( R N D { 1 )

248

* 10} + 1

V. ; ,

PRINT MyArray(I); SPACE?(1);


NEXT I
PRINT
INPUT "Which number do you want to find: "; FindMe
Left = 1
Right == MaxSize
Time2Stop = 0
WHILE' Time2Stop = 0
Half = INT({Left + Right) / 2)
:
IF FindMt < MyArray(Half) THEN
Right = Half - 1
ELSE
Left = Half + 1
END IF
IF (FindMe = MyArray(Half) OR Left > Right) THEN
Time2Stop = 1
END IF
. WEND
; IF FindMe = MyArray(Half) THEN
PRINT "Found it in location "; Half
! ELSE
PRINT "The number you want is not the list."
;END IF
END
, .
1.

MaxSize, , KaxSize 5
MyArray, (
MaxSize ) .

2.

, MyArray. , . .

3.

, . FindMe.

4.

Left
1.

5.

Right
MaxSize, .

6.

Time2Stop
0.

7.

WHILE WEND, , ,
FindMe, , .

8.

Half, .

21.

249

9.

, FindMe. FindMe , , Right Half-1. Left Half+1. Right


Left, .
Left , Right,
"", .

10. ,
, FinciMe. Time2Stop 1.
11. WHILE WEND.
12. Found it
in location, .
, The number you want is not the list.
13. .
.

- , ,
. ,
, .
. ,
( -),
. (
). ,
, , -.
, . ,
. . -:
'.:__ HashValue
=
MOD 5
.
_ .
.
..,_ ...
. . . .

..

,.'

,
, -. ,
26, - 1 (26 / 5 = 5 1).
MOD ,
. , 26 MOD 5 1.
Liberty BASIC
MOD, :
'_ HashValue .- - (INT (Number to Store / 5) * 5
, , - : , 1, 2, 3 4. -

250

V. : ,

, . -
26 1, , . 21.2.
- ,
.
26 ,
- ( 1) , 26 . ,
, (, ).

26

1. 26 .
2. - 26:
26 MOD 5 = 1

3. 26 .

. 21.2. , ,


- .
, - .
, - MOD 5 (
5, - ) 7 32, 2.
, , -.
- , . , , -. . 21.3 , , . ( 16
. 18
. , Liberty BASIC . C/C++, #, Pascal
Java .)
. 21.3 7 32 - ( 2). 7 2 ( 2), 32 7. ,

21.

251

- .

26

26

32

. 21.3.

-
- , , -. - ,
-.

-, . -
0
1
2
3
4
(. . 20.2), 50
41 57
-.
75
67
, .
,
Liberty BASIC,
41, 50, 57, 75, 67, ,
. 21.4.
Liberty BASIC
,
.. ,
,
- 0 4,
1 :

252

. 21.4.

V. : ,

:-MaxSize
! REDIM MyArray (MaxSize, MaxSize}
! FOR I = 1 TO MaxSize Vertical
FOR J =1 TO MaxSize ' Horizontal
MyArray (, J) = 0
NEXT J
r
.NEXT I f Count = 1
1 FOR J - 1 TO MaxSize
StopNow = 0
StoreMe = INT(RND(1)
100) + 1
HashValue = StoreMe - (INT
(INT (StoreMe
(StoreMe /
/5
5 **5 ) + 1
WHILE StopNow <> 1
IF MyArray (Count HashValue} - 0 THEN
MyArray (Count, HashValue) = StoreMe
StopNow = 1
ELSE
Count = Count + -1
END IF
WEND
PRINT StoreMe; SPACE$(1);
NEXT J
' PRINT
PRINT
FOR I = 1 TO MaxSize l Vertical
FOR J = 1 TO MaxSize * Horizontal
PRINT MyArray (I, J) ; SPACE$(5);
NEXT J
PRINT
NEXT I
END
.
1.

MaxSize, , MaxSize 5. MyArray, (5 5) .

2.

MyArray .
, I , J , . 21.4.
(: , Liberty BASIC, .
0, . 21.4,
1 Liberty BASIC;
1
2 Liberty BASIC ..)

3.

Count 1.
FORNEXT,
.

4.

21.

253

5.

stopNow 0.

6.

1 100
StoreMe.

7.

- HashValue. HashValue :
1, 2, 3,4 5.

8.

WHILE WEND, ,
, StoreMe.

9.


StoreKe ( Count) ,
HashValue. ,
.
, .

10. WHILE WEND,


.
11. .
12. FOR NEXT, .
13. .
14. , ,
, .
15. .

q
, , . ,
. , . , . ,
.
.
-, .
-.
: ,
. .
, - .

254

V. : ,

22


& . . .
>
>
>
>
>


. , , , , ( ) .
( ).
S
S
S ,

(, 2.0 4.0), .
(, 2.1 4.3),
( ) . ,
,
.

cfitfitftcifafftte

, .
,
, . , .
, .
, , . ,
, (
, ,

).
_

22.

255

,
.
, , .
1619.
18.

/3biofi
, . ,
,
. ,
, , ,
, .
, ,
. ,
, 30 ,
, . (
20 "".)
, 30 ,
, . ( 21 "".)

, . , .
, . ,
, - .

. ,
. , . , , .

, , , , .
.
, ,
,
, .

Haetiifiouica
,
, ""
. , ,
.

256

V. ; ,


AND IF THEN
, :
IF ( D ' A N D { 2) THEN
*
END IF

9 "
".

IF THEN , . , IF THEN . ,
AND, , ( ), . , 1 ,
2,
1 AND.
, 1 ,
2, , .


IF

THEN

ELSE

IF SELECT

CASE

, .
IF ( 1) THEN
1
.ELSEIF ( 2) THEN
*
END IF

IF THEN ELSE IF 1. ,
2.
, 1 ,
2 ? 1 ( ), 2 ( ).
1, , ,
, , , , IF THEN SLSE IF, :
:

IF ( 2} THEN
4
.,
ELSEIF ( 1) THEN
1

END IF

22.

257

, , , .
Liberty BASIC IF
THEN ELSE IF SELECT CASE.

SELECT CASE,
:
1

SELECT CASE
CASE !
' , .
!
CASE 2
' , =
2
END SELECT
SELECT CASE (, !).
SELECT CASE, .
, , ,
,
.

FOR NEXT
, , . , , FOR
NEXT. .
FOR NEXT . , ,
FOR NEXT, ?
FOR NEXT : ,
FOR NEXT, ,
; EXIT FOR , FOR NEXT.
, QBASIC, EXIT FOR , FOR NEXT . EXIT FOR FOR NEXT
30 , , , :
FoundIt = 0
FOR J = 1 30
". PRINT "Checking array location";
IF MyArray(J) = FindMe THEN
Foundlt = 1
EXIT FOR
END IF
NEXT J

258

V. : ,

Liberty BASIC EXIT FOR .


... -, . , , ,
.
:
FOR J - 1 5000
1=0
IF MyArray(J) = 55 THEN
PRINT MyArray(J)
' END IF
NEXT J
FOR NEXT 5000 , 1=0
FOR NEXT.
5000 .
1=0 FOR NEXT, :

i:

FOR J = 1 5000 IF MyArray(J) = 55 THEN


PRINT MyArray(J)
END IF
NEXT J
,
. , Liberty BASIC, IF THEN FOR NEXT.
. , , . , .
, C/C++,
?
, C/C++, ,
, , Pascal
BASIC. C/C++ , . ,
C/C++ ,
.
=+5 =+23, C/C++
:
X += 5; /* = +5*/
+= 23; /* = +23*/

22,

259

C/C++ , .
:
++; "/^ = +1*/
; /* - -1*/
:
++; /* = +1*/
; /* = -1*/
, , . , - {
, :
X. = + Z++

:
X = -rz

z" = z +1

:
= +
:

= -1
= b +
C/C++ IF THEN]
ELSE IF, :
p r i n t f ( " = %d\n", (>) ? : ) ;

IF THEN ELSE IF:
if (x>y)
printf(" = %d\n", ) ;
else
printf(" = %d\n",y);

"" IF THEN ELSE IF


, . .


(
) .
BASIC,

Liberty BASIC, integer (, DIM


Num AS INTEGER) long integer (, DIM Num AS LONG). long integer 2147483648 2147483647, integer 32768 32767.
long integer .
, long, .

260

V. : ,




, , , . ,
MyNumber I, :
I MyNumber = MyNumber 4- 1
, 1. , C/C++ :
;

MyNumber++

1
Delphi ( Pascal), :
I Inc (MyNumber)
,
. ,
. , , .

<$&/
,
, , C/C++, ,
, (Pascal BASIC).
, ,
.
,
Visual Basic, , , .
. -,
, ,
C/C++, , , .
, ,
(, ,
). -,
- ,
,
"" , .
, .
.

22.

261

, , Visual Basic,
, C/C++
.
, , .

. , , , . ,
C++ (,
Microsoft Visual C++), "" (, Borland C++) .
, .
, . 22.1.

. 22.1. Delphi
, ,
.
, , .
, ,
.

262

V. : ,

VI

Internet

, lApSAH, *, KAKO&O
Moi

\\

&

.
,
.
Internet
. ,
, , , Internet. , ,
, , .
I Internet. ,
Internet, . - , .
Internet HTML
(HyperText Markup Language ),
Web-.
Web- Java JavaScript. - Web-, , .

23

HTML
& . . .
> HTML
>
>
>
>
>
>

Internet . , 1992 CERN World Wide Web (


WWW, Web-, www.dialektika.com). , , World
Wide Web, Internet. Internet World Wide Web, World Wide Web Internet.
World Wide Web . World Wide Web , ( , ,
World Wide Web). ,
Web- , .
Internet ,
World Wide Web,
.
ASCII-, HTML (HyperText Markup Language ).
Web- HTML- ASCII-
.htm .html. Web-, , HTML- .


HTML- , . Web- HTML-, ASCII- .htm .html. HTML- , , . (
) , - , , :
:

<1> .</!>

23. HTML

265

ASCII- , .
(, ,
),
, ASCII-.
, : </!>
</BODY>.

, :
I<> .<1></1> .</>
, ., :
.
, . ,
, :
:<> <1> </> . </!>
.
, . 23.1.

<> 1>

<1 >
<2>

</2>

<2>

</1 >

</ 1 >

. 23.1. () ()
HTML
HTML- ,
, , HTML-
. , HTML- Web .

266

VI. Internet

HTML- Web- ,
Windows Liberty BASIC. , .htm
.html. HTML-, , ^.

HTML
HTML, Web:
<HTML>
</HTML>
Web-. ,
, Web-.
<HTML> </>
. ,
Web- .


,
( ) Web-, <HEAD>, :
<HTML>
<HEAD>
</HEAD>
</HTML>
<HEAD> </HEAD> .
- Web- "",
. , , .
, Web-,
NK1999.?
Web- , :
<

<HEAD>

<1> </1>
</HEAD>
</HTML>
Web- .

Web-
Web-,
<BODY> </BODY>, :

23. HTML

267

<HTML>
<HEAD>
<1> </1>
</HEAD>
<BODY>
</BODY>
</HTML>

^.


Liberty BASIC , , , . HTML-
Web- .
; HTML-. , :
;"<; : . >

< ' -- , -->


.

HTML Web- , ,
, Web- ,
. HTML .
S ( , ).
S , .
/ ,
HTML ,
.
S


HTML . ,
.

. 23.2.

HTML:

268

VI. Internet

<>
<4>
<5>
-<>

3</>
4</4>
5</5>
6</>

~ * 41

" ^
cran\web html

1
2
3
4
5

'||

/fct. 23.2. ,

HTML
- .
,
.
.


,
, , , ( ,
).
<>, </>, :
,
,
, . , .
, <BR>. , <BR> " ". <>,
</> <> . 23.3.

23. HTML

269

- \WlNDOWS\Pa&044fc CTon\walJ.tilml - Uivrasatt tatefnut


Qpuexa

fine,

^ - ':j3 j ' ''

-.^^
eb.html

'] ^D
:

,
,
.
,
.


.

Cfc ^3
\ wrti hlml -

;> ,
,
.
,
.

]
<Enter>
.

. 23.3.


, , , :
<BLOCKQUOTE>
.
</BLOCKQUOTE> .


(
), .
. :
s <> </> ;
S <1> </!> ;
/ <> </> ;
S <> </> ;

270

VI. Internet

" <HR> . (
, <HR> , .. .)
Web-
. 23.4.
3 \WINO/^& , t on\eb htei) - Mtetotalt Intemef x[lllMlr
1
*':--.=

. >

' * * & ' ;< .^ .^

!|*;

-ii- -*

CTon\weh.html

.
.
.
.
.
.

JOJ-*]

> .
,
.
! .
.


<Entr>
.

. 23.4.

. , HTML.
, . .
ALIGN ,
;
BGCOLOR Web-;
TEXT ;
LINK ;
VLINK , .

23. HTML

271


Web- ,
, ALIGN
, :
< ALIGN="center">

</?>


"center" ALIGN.
, "right" "left" ALIGN :
ALIGN="right">
! .



BGCOLOR TEXT.
, , red, blue yellow:
;<BODY BGCOLOR="white"> ( )
-<BODY TEXT="black"> ( )
, RGB.
, .
, : , , ,
.. :
:

BODY BGCOLOR=" FFFFFF"> ( )


;<BODY TEXT="000000"> ( )
RGB , 0 F (, 1, 2, 3, 4, 5, 6, 7, 8, 9, , , , D, E, F). , F . ,
.
(R),
(G), (). ,
-, :
:

<BODY BGCOLOR="FFOOOO">

, ,
:
:<BODY BGCOLOR="OOFFOO">

, ,
:
<BODY BGCOLOR="OGOQFF">

272

VI. Internet


. Web- , .
, , , Web- .
:
<BODY ="_">
<BODY ="# ">

LINK , . V L I N K
, .


Web- .
, .
, , Web- .
HTML (
).
I S .
.
I S .
.
f /

.
.


HTML. <UL> </UL> . <>,
. :
. <UL>
<> .
=
I <> .
| <> .
I </UL>

<> , ..
, </>.
.
, :
' <UL>
I <LI> ".
, <> .
<UL>

23. HTML

273

<1|1> .
<> .
<> .
</UL>
j <> .
\</UL>
. 23.5.
.
Hi \WINDOWS\Pnfin4Mft cTDrtiwebhtml Miimr.nftl
2 gun
>

jftflpeeW]C\WINDOWStf ab04Hu cTOn\weu.html

v] ^ ;;

1. .
2. .
1. .
2. .
3. .
3. .

<1> *.
<11> .
<OL>
<1> .
<1_1> .
<11> .
</OL>
<11> .
</OL>

. 23.5.


,
. 1, 2 . .
HTML,
<OL> </OL>.
<>. :
<OL>
<> .
<> .
<> .

274

VI. Internet

, .

<>

<1> .
<> .
<OL>
<> .
<> .
<1> .
</OL>
<> .
</OL>
. 23.6. ,
.
-|[*|
___

"

CSPBL*C

"

,, , ,, ~ ;/J jj >JJ |^ i ^S>4ypwofl - ^5 iJ

,
.

, .

3;

<DL>
<>
<00> .
.
<
<00>, ,
<>
<00> .

</DL>

. 23.6.


- , , , . HTML.

23. HTML

275

<DL> </DL> .
<> , .
<DD> , <DT>.
,
:
<DL>
<01>
<00> ,
.
<
<DD>, .
<DT>
<00> .
</DL>


Web- :
( , ), - , , Web, . .
S , Web-, ( ).
/ , Web-
Web- Web-.
, <> </>. -
. -
, .


HREF ( Hypertext REFerence) .
I ^ , ,
:
1

http://www..com

I V , , .
HREF -, :
' < HREF="http://www.dialektika.com">Aflpec -</>
Web-.
Web- www. dialektika. com.

276

VI. Internet

,
Web-, ,
, Web- .


Web- Web- HREF, Web-
Web -:
; < ="1},;1 1 '></>

.
Web-,
index.html.

Web-
, Web-,
, Web-, . Web-, . ,
,
, Web-, .
1.

Web-,
.

2. ,
Web-, - Web-.
3. , .
NAME:
Web- , . .
, ..
, toe. , .
, , HREF, Web-, ,
Web- #, :
' < HREF="index.html#TOC">nepexofl </>
. , Web index.html , .
, , , Web-.

23. HTML

277

zfuupuicu
Web- ,
HTML Web- , . Web .
Web-
GIF (Graphics Interchange Format ) JPEG
(Joint Photography Experts Group ), .

Web-
Web- <1MG> SRC, , . :
;<IMG ="_.1">

, ALIGN. , , , :
.<IMG ="_.1" ALIGN=middle>

. 23.7.
' gun


.1] .
j (^ \

,
]

. 23.7.


Web-
. BACKGROUND BODY, :
. <BODY- "BACKGROUND =" .GIF">

278

VI. Internet


HTML ,
- .
, .
<FORM> </FCRM>, <BODY> </BODY>:
<HTML>
<BODY>
<FORM>
</FORM>
</BODY>
</HTML>
, <FORM> </FORM> <BODY> </BODY>, .
<FORM> </FORM> ,
, . 23.8. .
</ . , .
S . ,
.
S . ,
.
/ . , .
j.a \WINnoWS\Pa6o4Hrt ciofl\eb.Mml -MiciusuM Intninef ExpliMiM

; --;... ' * - . / ) _ : ] JJ , ^

^- _J Iff

'


i:

. 23.8.
, .

23. HTML

279


-
. , , , .
, , ,
. . HTML- .
s onAbort. ,
, .
s onBlur. , (
) .
.
S onChange. , , .
^ onclick. , , .
^ onFocus. , <>.
^ onMouseOut. ,
.
/ onMouseOver. , .
/ onSelect. , .
,
. .


,
. <FORM> </FORM> :
' <FORM>
<INPUT
TYPE=text
="__"
VALUE="TeKCT "
SIZE=integer
[onBlur="coirnnaricl"]
[ onChange="commarid" ]
[onFocus="command"]
[onSelect="command"]
</FORM>
TYPE=text .
NAME .
VALUE . SIZE , .

280

VI. Internet

, onBlur, onChange, onFocus


onSelect. ,
! ! , .
<HTML>
<BODY>
<FORM>
<INPUT>
TYPE=text
NAME="textboxName"
=" "
SIZE=30
onFocus="textboxName. v.alue= '! !'">
</FORM>
</BODY>
</HTML>
, onFocus , .
,
onFocus. , ,
, .


,
. <FORM>
</FORM> :
<FORM>
<INPUT
TYPE=bUtton
=" "

VALUE=" "
[onBlur="handlerText"]
[onFocus="handlerText"]
:</FORM>
TYPE=button . NAME . VALUE , .
, onBlur, onclick onFocus.

Web-, index. html, .
|<HTML>.
', <BODY>
!<INPUT
TYPE=button
NAME="open"
=" "
onClick="mywindow= window.open ( * index.html'} ">
I <INPUT
TYPE=button
NAME="close"
VALUE=" ."

23. HTML

281

onClick="mywindow.close()">
</FQRM>
</BODY>
'HTML>
, , onclick, . ,
, ,
.


, , . <FORM> </FORM> :
;<FORM>
I < IN PUT -.-

TYPE=checkbox
="_"
VALUE="checkboxValue"
[CHECKED]
ConBlue="handlerText"]
[onClick="handlerText")
EonFocus="handlerText"]>
textToDisplay
</FORM>

TYPE=checkbox . NAME . VALUE , .


CHECKED . textToDisplay , .
, onBlur, onClick onFocus.
:
<HTML>
'<BODY>
<2. ?</2>
<FOR]yi> .
<INPUT
TYPE = checkbox
NAME="checkl" VALUED99
onClick="litterbox.value = '
.' ">

<BR>
<INPOT
TYPE = checkbox
NAME="check2"
VALUE=99
onClick="litterbox.value = ' .' ">

<BR>
<INPUT
TYPE = checkbox
NAM=" check3" -

282

VI. Internet

VALDE=99
onClick="litterbox.value = ' . 1 ">

<BR>
<INPUT
= text
HAME="litterbox"
VALUE=""
SIXE = 40>
</FORM>
</BODY>
</HTML>
, , . 23.9.
, ,
. , .
I C:\W!NUOWS\Pa5o4m \*8 Mml -Mieesalt [! Explorer

JJ
iApc[^C\WINDOWB^Fo5ocorrtwe^l^

?


jj5
| .

^2[

. 23.9.


, ,
. , ,
:
?
.

23. / HTML

283

.
, , , , "".
, , :
: <FORM>
j <!NPUT
TYPS=radio
="_"
VALUED "buttonValue"
[CHECKED] .
[onBiur="handlerTaxt"]
[ onCl ick= "hancUerText " j
[onFocus= M haridlerText"] >
textToDisplay
</FQRM>
TYPE=radio . NAME .
,
, . ,
,
.
VALUE , . CHECKED
. t e x t T o D i s p l a y
, .
, onBlur, onclick onFocus. , . :
' <BDDY>
" <2 . ?</2>
<FORM>
-< INPUT
-TYPE = radio
-NAME="groupl"
VALUE=99
onClick="litterbox. value = '
. ' ">

<BR>
. < INPUT
TYPE = radio
NAME="groupl"
VALUE =9 9
onClick="litteri)Ox. value = ' . ' ">

\ <BR>
<NPUT
T.YPE = radio
NAKE="grQ-upl"
VALUED 9 9
anClick="litterbox. value = ' . '">

284

VI. Internet


<BR>
<INPUT
TYPE - text
NAME="litterbox"
VALUE=""
SIZE = 40> '
</FORM>
</BODY>
</HTML>

..... _____^ -- .

____ .

--_

._.

- -

_____

... ___________ : ----- : _ . _

,
groupl. , .

cfieqcifU!
HTML-,
, ,
Web-. HTML , ,
Web- .

Web- ,
( ) Web-
Web-.

, , . , Web-
Internet,
HTML, .

23, HTML

285

24


Web- JavaScript
* ...
> JavaScript
>
>

JJ

/ TML- Web-,
. , Web- , , Web- -,
Web-
.
Web- Web JavaScript VBScript.
, JavaScript
VBScript, Web-.
, JavaScript
Java. JavaScript ,
, , . Java, , .
JavaScript,
(,
Windows Liberty BASIC),
.htm .html. -, ^, , , JavaScript.
JavaScript Netscape. Microsoft
, VBScript. , JavaScript, , Visual Basic. ,
JavaScript VBScript,
.

286

VI. Internet

JavaScript
, JavaScript,
, HTML, :
I < s c r i p t language = "JavaScript">
\ </script>
, JavaScript,
HTML <BODY> </BODY>:
' <HTML>
<HEAD>
<1></TITLE>
</HEAD>
<BODY>"
<script language = "JavaScript">
</script>
</BODY>
</HTML>
,:..,.,.. . . ,

..

'...:_

JavaScript,
<script>
</script>:
!<script language = "JavaScript">

: <!

;//-->

;</script>

JavaScript
JavaScript . ( 19, " - ".) : , .
, . , . document, a
write. , , .
JavaScript,
, , ,
JavaScript. , JavaScript ,
JavaScript document, write ("
1
."), , document
!.

JavaScript , , .
- JavaScript, , L-.

24. bVeb- JavaScript

287

JavaScript HTML-, .
JavaScript SRC, :
,<script language = "JavaScript" SRC="program.js">
I</script>
, JavaScript, program, js.


JavaScript document .write
. , ,
:
I document .write (" ,")
- ,
HTML . ,
HTML, :
: document. write ("<>" / .", ;
document .write
"-", :
document .write ("<B>, .",
"</>" + " - .")
:
.
. . -


document. write '-" ,
. JavaScript var:
_

JavaScript ;
.
"+" , :
' <script language = "JavaScript ">
<!
var mymessage
mymessage = " ."
Document - w r i t e ("
? : " + mymessage}- "
//-->
</script>

288

VI. Internet

, JavaScript, .
1.

, ,
<script> </script>, , JavaScript.

2.

mymessage.

3.

mymessage .

4.


? : .

5.

, JavaScript.


document .write . JavaScript ,
. JavaScript .



. , , -
- , . 24.1.
ilert(" . !"}

' 1\

. 24.1. ,
alert JavaScript
a l e r t ,
, .


. , ,
confirm, t r u e . , -

24. Web- JavaScript

289

, c o n f i r m , f a l s e .
, . 24.2.
' i f (confirm!" ? " ) )
document,write(" ,")
else
;document.write(" , Windows
, , .")

? i t
~~

. 24.2. ,
confirm
JavaScript
,
. , : , Windows
, .


- , , ,
. 24.3. , prompt, :
1

prompt{" ?")
larmoctionbinnnrenn
.
- ?

. 24.3. , prompt
JavaScript. 98
, , (
. 24.3), :
;

prompt((" ?", 98)


,
undefined.

, , -

290

VI. Internet

. ,
, :
<script language = " JavaScript">
l<l
; var userdata
userdata = prompt (" ?", 98)
' document. write {" = ", userdata)
</script>

, JavaScript, .
1.

2.

, ,
<script> </script>, , JavaScript.
userdata.

3.


?; , 98.

userdata.

4.


=, userdata.

5.

, JavaScript.


JavaScript,
, .
.
/ function. JavaScript.
S . JavaScript ""
. square:
, . _~.
. .
~~. ~.~~.
..._
._.._
..
---.,
I function square() {
\ return *
!1

(), . ,
. .

S .
, .
, ,
, .
:

24. Web- JavaScript

291

function _() {
//
,
, . ,
:
:

function, square () {
return"

, ,
return JavaScript,
{,
Windows), .htm .html:
! <html>
\ <body>
i <:script" language = "JavaScript">
;function square (number) {
return number * number
I }
I function printbig (headlevel , headtext) {
, document-write("<H", htadlevel, ">, headtext,
"</H", headlevel, ">")
:var myvalue, longstring
myvalue = prompt{" ?", 98)
Longstring = " - = " + square (inyvalue)
printbig (2, longstring)
,</script>
'</body>
</html> , JavaScript,
<script> .
1.

2.

3.
4.

5.

292

, ,
<script> </script>, , JavaScript.
JavaScript
,
JavaScript.
square,
, number,
square
number ,
JavaScript.
square.

VI. Internet

6.
7.
8.
9.
10.

11.

printbig, ,
headlevel headtext.
HTML
.
printbig.
myvalue longstring.

?;
, 98.
myvalue.
square, myvalue.
- .
longstring.

12. printbig 2
Icn.gstring. . printbig
longstring.

,
, Web-. (
Web- ,
.)


<script> </script> open, :
<script language = "JavaScript" SRC="program.js">
^\
= window.open( Web-)
//>
</script>
window.open, , . 23, " HTML".
_, . ,
. , Web, , :
MyWindow = window.open{"index.html")
Mywindow Web-,
index.html. ,
Web-, , :

24. Web- JavaScript

293


,
,
. , ,
, :
iMyWindow = window.open("index.html", "_",.
"toolbar=no, resizable=yes")
, Web- index.html.
, .
.
,
. ,
, .
V

toolbar [ = y e s | n o j | [ = 1 | 0 ] .
, , , . .
' ' l o c a t i o n [=yes|no] I [ = 1 | 0 ] . , Web-.
S' directories [ = y e s | n o ] I [ = 1 | 0 ] . .
V status [=yes | n o ] 1 [=11 0] . .
S menubar [>yes I no] I [=11 0] . .
s scrollbars [=yes|no] ] [ = 1 | 0 ] . , .
/ resizeble [=yes|no] | [ = l ] 0 ] .
.
J width=pixels.. .
f ^ height pixels. .
, , , toolbar 0, .
yes/no:
[

MyWindow = window.open ( ( "index, html", " ",, "toolbar=no"}

1/0:
: MyWindow = window.open {("index.html", "^", "toolbar=0")


, .
, close:
:_.close()
_. , , :
; .close ()

294

VI. Internet

close ,
, :
i W e i r d S t u f f = window.open{"index.html")
:
;WeirdStuff.close{)
JavaScript ,
. JavaScript JavaScript " ". 2- , . ( "").

24. Web- JavaScript

295

25

Java-
Web-
&
> Java-
> Java- Web-
> Java-

JavaScript
( Web-) , Web-. ( Java ,
.)
Java, Web . ( Java, , - .)
Java-
, , , , . Java, Java Programming For Dummies (Donald
J. Koosis and David Koosis) IDG Books Worldwide, Inc.

atra-a/uetfot
Java- ,
Java. , C++ ( ),
Java- -.
- , ,
Java. Java, Visual Cafe
WebGain,
- .
, Java, ASCII-
. Java, V i r u s . Java. Java - .class,
V i r u s .class-

296

VI. Internet

Java JavaScript

, Java JavaScript, Web- i


, HTML )
Java, JavaScript?
JavaScript Java ,
Web-. , Java
, , ,
, JavaScript.
, JavaScript , ",
Java . ,
Web-, .
, ,
Java-, -. Java-, -, ( ) , Java
(Java Virtual Machine Java VM). ( , Web- Microsoft Internet Explorer Netscape Navigator.)
Java- ,
Java, ,
Windows, Mac OS UNIX. Java- -,
,
.
, Java- ( ,
), ,
! :
port java.awt.*;*:
import j ava. applet . Applet;
public class TrivialApplet extends Applet
{
Font f = new Font("TimesRoman", Font. BOLD, 2 4 ) ;
public void i n i t O {
repaint ( ) ;
}
public viod paint ( Graphics g } {
.g.setFont(f)
g.setColor (Color. blue) ;
g. drawstring ("He !" , 15, 75 );

. 25.1.
Java-
Java- , ..
" ", Java . Java -

25. Java- Web-

297

, , , , , .
, Java "" . , ,
, Java - ,
.

<bofly>
<epplt
</lpplet>

HDppUt.elM** width = 258 blight ' 1BB>

Puc. 25.1. Java-, Web

Java ,
Java?
Java,
Sun Microsystems Java, ,
Web- {j ava. sun. com). Java, ?
-, Sun Microsystems . Sun Microsystems -
: ,
, .
-, Java Sun Microsystems. , JBuilder (
Borland) Java-
, . Visual Cafe WebGain
Java, Java- - ( ) ( , Microsoft Windows).

298

VI. Internet

(
Liberty BASIC Windows). Java - Java, Sun Microsystems (java.sun.com) JBuilder Borland (www.borland.com)
CodeWarrior Metrowerks (www .metrowerks . com).

tut
Java- -, HTML Java- Web-. Java Web- ,
<BODY> </BODY>:
\ APPLET. CODE = "HMfl_Java-armeTa">
: , ,

; </>

HHH^Java-arLneTa Java, .. ,
Message . class, :
; <APPLET CODE.= "Message. class">
, ,
; </APPLET>
; .
:

<APPLET> </APPLET> . , Web Java-. , Web-, , , Java- .

Java-
, ,
Java-, WIDTH HEIGHT, :
<APPLET CODE = "Message. class"> WIDTH = 250 HEIGHT = 100> :
^, ,
Java- 250x100 .

Java-
Java- Web-
ALIGN, Web- . ALIGN.
ALIGN=TOP. .
ALIGN=MIDDLE. .
ALIGN=BOTTQM. .
. 25.2.

25. Java- Web-

299

lUjX 5= * CfRr
J "' Jj^aScftHi

He !

He !

. 25.2.

Java-
Java-, ,
HSPACE VSPACE :
<APPLET CODE = "Message.class"> WIDTH = 250 HEIGHT = 100> VSPACE = 25 :
HSPACE = 15>
, ,
,</APPLET>
25 , 15 .
HSPACE VSPACE . 25.3.

Jlo uctc
Java-,
Java,
. Java ( ),
Java-, .
Web- Java-,
, . , ,
; , Java.
Web-, Java-, Internet, Hotbot (www.hotbot.com) Excite
(www.excite.com), Java applet.
Yahoo! (www . yahoo . com)
Computers and Internet, Programming Languages, Java , , Applets.

300

VI. Internet

Web-, Java, , .
. f!

pa HSP
ira !
nqjeuc

HSPACE 55
!

VSP 4!

. 25.3. HSPACE VSPACE Web-

25, Java- Web-

301

26

Python
& ...
>
>
>
>

Python

^^

Python , , , . Python ,
,
"" , ,
.
Python , , , Python, , , Linux, Windows Macintosh. , Python Internet-, ,
Web- , .
, (. , )
, Python. Google (www.google.com) Python. ,
, , Python.

Python , , , . , Web- Python www.python.org.


Python ,
. . 26.1 Python Windows.
Python, BASIC, ,
, .
Python C/C++, ,
C/C++.

302

VI. Internet

El* Edit Cebug fcje'p


Fythor. 2 . Q 189, Oct 16 2 0 0 0 ,
Type "copyright", "credits"
IDLE C . 6 press Fl for help

[M3C 32 bit (Intel) ; or. Win32

Puc. 26.1. Python Windows



Python. ,
, Liberty BASIC,
.


, C/C++ Java, , string, real
.. ,
string, .
Python .
, Python
. - , :
I_ =

:
; _ =* ""
, , .
Python.
X cheese4sale = 25
.>. print ' -'f \
cheese4sale
- 25
',> cheese4sale = ' '
> print ', * , |
Cheese4sale

26. Python

303

,
Python : >. ,
, , .
Python , , PRINT
( print), cheese4sale
Cheese4sale .
Python
.
1.

cheese4sale
25.

2.

:
-,
cheese4sale, 25.

3.

, , : - 25.

4. cheese4sale
.
5.

: ,
,
cheese4sale, .

6.

, , : , .

7.


Python, .


Python, , , Windows, , Python .
, Python
, :
> X =

> print X
j.63

, "" ( ),
:
' > X - ''
> Y - 'the'
> z - 'Cat. '

304

VI. Internet

i > print X+Y+Z


Bo the Cat.


Python , , . ,
,
(. 18, " "), Python ,
.
Python .
. (
16, " ".) , , .

. "" ( , )
( ,
).
Python
, , :
_ = [!, 2, , 4]

Python :
> randomthoughts = ['girls', 3.1415, ''money', 900, 3.2, 'dogs']
> print randomthoughts
,['girls', 3.1415, 'money', 900, 3.2, 'dogs']
, Python , .
S append ( ) . ,
.
/ extend ( ) . ,
, [ 4 5 , "Greetings", 9 . 0 9 ] .
S insert ( i , x ) . ,
, a i . Python
0, 1 . .
/ remove ( ) . ,
.
*" p o p ( [ i ] > . , i,
.
s index ( ) . ( ) .
^ count ( ) . , ,
.
s sort (). . Python ,
.

26. Python

305

^ r e v e r s e ; ) . , ..
, sort ( ) .

, ,
Python:
> cats = [ ' ' , ' S c r a p s ' , 'Tasha', ' N u i t 1 ]
; > cats, insert (1, "Thomas")
; > print cats
' Bo ' , ' Thomas ' , ' Scraps ' , ' Tasha ' , ' Nuit ' ]
[ > cats, reverse ()
: > print cats
[ ' N u i t ' , ' T a s h a 1 , 'Scraps', 'Thomas', 'Bo']
; > cats . sort ( )
'> print cats
I ['Bo 1 , ' N u i t ' , 'Scraps', ' T a s h a ' , 'Thomas']
i > cats . remove ( ' Thomas ' )
; > print cats
['Bo', ' N u i t ' , 'Scraps', ' T a s h a ' )
( ) , Python,
, ,
. Python .
> diet - {}
> diet [ 'government'] = " - '<
."
>dict['prison'] = " .
. "
> print diet [ 'government']
.
Python
.
1.

2.

:
^ ,
'government 1 .

3.

:
,
' p r i s o n ' .

4. , , 'government'.
5.

306

:
, Python , .

VI. Internet

,
. , Python ,
, , /-+ BASIC, .
,
( ), ,
,
, .


. (
) , .
BASIC .

S REM

S ' ()

Python #. Python:
# Python
Python ,
#.
, .

cidfttficifU/fi
1 , , . if,
: , -
. if Python :
[ > if ():
;
;
> 45 total = 5,
true f a l s e . (. .
false), if. (. . true), if, :

| > age = 56

; > if age < 65:


;print ' .'
' .

26. Python

307

BASIC IF THEN ELSE (


9, " "),
:
IF ()

THEN

, , ELSE

, ,
END IF

IF THEN ELSE , , , . Python if else :


I if age < 65:
print ' .'
;else:
j,print ' ,
.'.

, else,
- . ,
,
if e l i f , :
j i f (!):
[, , !.
" e l i f (2):
, , 2
if elif else:
if (!):
, , !
elif {2):
, , 2
else:
, , =

e l i f , :
;if (!):
^, ,
fcel-if (2) :
;, ,
- if (): .
I , ,
;elif (}:
\, ,
\ else:
;.,

308

!
2


VI. Internet


,
. Python
, while for.
.

while
while Python , WHILE WEND BASIC, :
; while () :
- , /

while ,
true f a l s e .
, .

, while,
:

> age = 1
> while age < 5:
print age

age = age 4- 1
1
2
3
4

Python
.
1.

age
1.

2.

while ,
, , < 5.

3.


age.

4.

age 1.

5.

while Python .

6.


Python, .

26. Python

309

for
for Python ,
FOR NEXT BASIC. BASIC ( ) FOR NEXT :
I FOR I = 1 5

. NEXT I
;

__

-,_,. .

__

Python for , . , , . ,
, , for , , :
| > mylist = Peats', 5 8 . 3 , 3,
for x in mylist:
F >
. print x
cats
;58.3
|3

Megs', *five and twenty']

'. dogs
five and twenty

Python
.
1.

, : 'cats' , 58.3, 3, Megs', ' f i v e


and twenty' , mylist.

2.

for , mylist.

3.

,
m y l i s t .

4.


for Python .

5.


Python, .

//
, , , , Python,
, . , ,
, Python .
def, :
\ def _
!

370

( ) :

VI. Internet

, , , :
Idef moronspotter (mytarget):
mytarget + - !'
, ,
:
> moronspotter ( 'Bill McPherson') Bill McPherson - !
Python
.
1.


moronspotter 'Bill McPherson'.

2.


'Bill
McPherson' moronspotter. Bill McPherson - !

3.


Python, .

Python , , . , moronspotter 'Bobby Lee':


j.'def moronspotter (mytarget = 4Bobby Lee' } :
Linytarget + '- !'
, ,
:
> moronspotter ( Von Markey')
Jon Markey - !
, :
> moronspotter ()
Bobby Lee- !
,
Python, >. ,
>.

26, Python

311

VII

&
, : ?
.
, .
, . ,
, , .

27



/3 / . . .
>
>
>
>
>
>
>
>
>
>


Internet

, , .
. ,

// /
&, /& /&
, , . , ( ),
, .
. , . , . , ,
, .
, , ( , ).
,
. ,
C/C++ ,
.
Metrowerks (www.metrowerks.com) -

27.

315

CodeWarrior,
C/C++ Sony PlayStation Nintendo.
,
. (
).
, ,
. , ,
. ,
, , .
Crystal Space,
, Windows, Linux MacOS, Web- Crystal Space
(crystal.linuxgames.com). (
), . , , .
- ,
.
.
, . .
, Web ( ).
/ International Game Developers Association (www.cgda.org).
, . ,
.
*/ Game Developer (www.gdmad.com). ,

.
S Game Programmer (gameprodrammer.com). Web-, Internet,
.
s DigiPen (www.digipen.edu). , .
.
s GameJobs (www.gamejobs.com). , , , .


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

316

VII,

, Web-.
s Pixar Animation Studios (www.pixar.com). , , Toy Story (
) A Bug's Life ( ).
</ Animation and Graphics Club (www.mit.edu/magc/www). (Massachusetts Institute
of
Technologies MIT), .
^ International Animated Film Society ( w w w . a s i f a ~ h o l l y w o o d . o r g ) . ,
.
s Animation Magazine (www.animag.com). .
/ National Centre for Computer Animation (ncca.bournemouth.ac.uk). .
S Computer Graphics World Online (http: //cgw.pennnet. com/home/
home.cfm). , , , , .

,
, , .
.
, ,
.
, ,
.

, . , .

( ). , C/C++.
, ,
.
,
, . .
,
Web-. , C/C++, , .

27.

377

CypherNet (www.cypher.net). , .
Central Intelligence Agency (www.cia.gov). , .
North American Cryptography Archives (www.cryptography.org). ,

.
International PGP Home Page (www.pgpi.com).
(Pretty Good Privacy PGP).
RSA (www. rsasecurity. com). ,
, Internet.

Jntentet
, Internet, ,
, , ,
Web-. Internet, Internet .
, , HTML,
Web-. ( .)
HTML Web-.
Internet ,
Web-
: Java, XML, JavaScript, VBScript, Perl, C# Python.
Internet,
HTML.
Internet (, JavaScript).
Windows 2000, Linux Unix,
SQL. Web-, Apache (
Linux).
Web- , ,
( ), Internet.
Cool Web Jobs (www. cool web jobs . co.uk). Internet, .
GeerFinder (www.geekfinder.com).
.
Web Jobs USA (www.webjobsusa.com). ,
Web Internet.
Java Jobs (javajobs.com).
,
Java.

318

VII.

&

. , , : , ,
, , ..

.
Michelangelo, CIH, Melissa LoveBug.
,
, -
, . ,
, , .
,
VBA (Visual Basic for Applications Visual Basic ).
Microsoft. ,
, .
. ,
, Web-.
| / Network Associates (www.nai.com). VirusScan.
Sophos (www. sophos . com).
Sophos AntiVirus.
Symantec (www.symantec.com).
Norton AntiVirus.
Trend Micro (www.trend.com). PC-cillin AntiVirus.
F-Secure (www.datafellows.com). F-Prot.

, . , , , .

, .
. , , .
, .
"" ,
, . , , .
,
, Web-.

27.

319

Ethical Hackers Against Pedophilia (www.ehap.org). , Web-, .


AntiOnline (www.antionline.com).
, .
2600 ( w w w . 2600. com). ,
, .
Hacker News Network (www. ha eke rnews. com).
.

&&,
, .
, . ,
, .
,
, .
,
Linux GNOME Linux.
- , .
, - ,
, .
, .
, .
, Web-.
s Open Source (www.opensource.org).
.
s Free Software Foundation (www. f s f . org).
GNU .
^ Perl (www. p e r l . com).
Perl,
Internet.
/ Apple Open Source (www.publicsource.apple.com).
, ,
Apple.
/ GNOME project (www.gnome.org).
GNOME
Linux.
^ Mozilla ( w w w . m o z i l l a . o r g ) . Netscape
Navigator, Web-.
s Linux (www.linux.org). Unix.

320

VII.

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

,
. , ,
, Microsoft Word, Lotus Notes, C++ .
- ,
,
, . , ,
.
,
, .

fljtocfOJtca &

nftotftoMMHOio

, .
, .
Internet.

27,

321

- .
, .
,
.
,
,
( ). (
WinZip,
Web- www.winzip.com.) , , .
, , - . , , .
, . ,
, , , Palm
PocketPC.
,
. ,
- , , ?

322

VII.

28



/3 . . .
>
>
>
>
>
>


-



Usenet

^^

Liberty BASIC , , , , . ,
Liberty BASIC, , - .
,
, C/C++, # Java. , C/C++,
# Java, (
) Visual Basic.
, C/C++, #, Java BASIC,
: Modula-2, LISP,
LOGO, Scheme, Prolog, ICON, APL, COBOL, FORTRAN, Ada Perl?
,
, ,
.
"" , , , .
,
, ,
, .

. ( ,
, 4, " ".) ,
, - -

28.

323

, . ( , ), ,
,
( 50 150 ).

Windows
, Microsoft Windows
( Linux ).
, , ,
Windows-.
Windows-
Visual C++, Microsoft ( w w w . m i c r o s o f t . com). v i s u a l , Visual C++ , . ,
Windows, , Visual C++.
C/C++ Windows,
Visual Basic.
Visual C++, Visual Basic . Visual Basic,
, ,
BASIC. Liberty BASIC,
Visual Basic.
, C++,
Microsoft #. # C/C++, , Visual Basic.
Java Visual Cafe WebGain (www.webgain.com),
Java- Windows.
, Visual Cafe ,
Windows.
Visual Cafe JBuilder Borland (www.borland.com),
. , JBuilder,
Visual Cafe.
Borland
C++ Builder Delphi. Visual C++
Microsoft, C++ Builder , ,
Visual Basic. , C++, .
RAD (Rapid Application
Development)
. ( RAD 2, "- ".)

324

VII.

C++ , , Visual Basic, Borland Delphi. Visual Basic


C++ Builder, Delphi , Pascal.
Delphi ( ), ,
Visual Basic, ,
, , Visual C++. (
, , , Visual Basic,
, , Visual C++, .)
- -
(, Windows, Unix Mac OS), , CodeWarrior Metrowerks
(www.metrowerks. com). ,
Visual C++ C++ Builder, CodeWarrior ,
Windows, Solaris, Linux Macintosh, ( , ) , CodeWarrior Windows,
CodeWarrior Linux ,
- .
, . 27.1 Windows.

27.1. Windows

Web-

Visual C++

, C++

www.microsoft.com

Visual Basic

BASIC

www.microsoft.com

Visual Cafe

Java

www.webgain.com

CodeWarrior

C, C++, Java

www.metrowerks.com

JBuilder

Java

C++ Builder

C, C++

www.borland.com

Delphi

Pascal

www.borland.com

www.borland.com

Macintosh Palm OS
Macintosh
,
. ,
.
Macintosh
CodeWarrior, . CodeWarrior, Mettvwerks (www.metrowerks.com), , , C++- Java. , ,
.
, Metrowerks CodeWarrior, Windows (Windows 95/98/Me/N/2000
Windows CE), Solaris, Linux, Sony PlayStation Nintendo,
Palm.

28.

325

Macintosh, Palm Sony PlayStation Nintendo, CodeWarrior (, )


.


Microsoft Windows, Windows ( PocketPC). , ,
Windows 95/98/Me/NT/2000, Windows . ,
, . Windows , ,
,

Windows CE/PocketPC, Visual Basic Visual C++.



Windows CE/PocketPC PocketC {www. orbworks. com) NSBAS1C (www. nsbasic. com).
PocketC , a NSBASIC BASIC. PocketC NSBASIC , Visual Basic Visual C++,

Windows CE/PocketPC.
PocketC NSBASIC
Palm OS, Palm. Windows CE/PocketPC Palm , ,
Windows CE/PocketPC, Palm, ,
.
, CodeWarrior, BASIC, Macintosh, BASIC, Future Basic REALBasic.
Future Basic ( Web- www. s t a z s o f t w a r e , com)
Liberty BASIC, Macintosh.
REALBasic ( Web- www. realbasic. com)
Visual Basic;
, , .
REALBasic , Visual Basic,
Macintosh. , Visual Basic, Macintosh, REALBasic.
, , Visual Basic,
REALBasic , . ,
, Windows Macintosh, REALBasic, .
Macintosh
. 27.2.

326

VII.

27.2. Macintosh

Web-

CodeWarrior

, + -, Java

www, metrowerks.com

RealBasic

BASIC

www.realbasic.com

Future Basic

BASIC

www.stazsoftware.com

Linux
- Microsoft , Linux. Linux
, Linux.
, , Linux-
( CodeWarrior, JBuilder Delphi);
, .
Linux (RedHat, Caldera Black Cat,
), , GNU
( ) EGCS (
C++).
, Linux ,
Windows Macintosh, Linux-
, Ada, Pascal, FORTRAN BASIC.
Linux Web- Linux Programming
www. linuxprograrraning. com.

& if
, .

, - .
- ,
, C++ Java.
, , - .
Web- Catalog of Free Compilers and
Interpreters w w w . idiom, com/free-compilers.

BASIC
BASIC, MS DOS Windows, PowerBasic
(www.powerbasic.com). MS DOS - PowerBasic FirstBasic. Windows PowerBasic for Windows.

28.

327

( ) Macintosh, Chipmunk Basic Web- www. r a h u l . n e t / r h n / c b a s .page. html.


, , . C/C++ , BASIC Windows, DarkBASIC
( Web- www. darkbasic. . uk), .

C/C++ Java
C++ ,
. C/C++, - .
Linux GNU ,
Windows, Cygwin ( Web-
http: //sources . redhat. com/cygwin).
Java, Web-
Sun Microsystems ( j a v a . s a n . c o m ) , . Java,
, Java. ,
, J Builder Visual Cafe.

Pascal
MS DOS, Windows Linux, Free
Pascal Web- www. f r e e p a s c a l . org.
, Web- Bloodshed Software (www.bloodshed.com),

Pascal Windows.




, C/C++ BASIC.
, ,
.
Prolog
.
Prolog ,
Strawberry Prolog Web- w w w , dobrev.com.
1980-
Ada . , Ada
C/C++, Ada . , Ada , , ,
,
GNAT Ada Web- w w w . gnat. com.

328

VII.

BASIC , LOGO, . Windows,


LOGO, MSW Logo
Softronics (www. sof tronix. com).
, Web- dir. yahoo. com/Computers_and_Internet/
Programming_Languages, .
.

, , , ,

, C/C++ Java. , ,
.. - .

.
, . .
S ,
.
/ , ,
, .

, , ,
.
S ( )
, .
S ( ).
^ . , , ,
.
S
.
^ , ,
, .

28.

329

KnowledgePro
Knowledge Pro - , . MS DOS Windows,
KnowledgePro
, , .
KnowledgePro
C++, . ,
, KnowledgePro, .
,
KnowledgePro, Web- - (www.kgarden.com),
KnowledgePro , KnowledgePro.

Clarion
Clarion
. , Clarion, , , ,
Microsoft Access Visual FoxPro.
, Clarion ,
Windows 95/98/Me/NT/20QO World Wide Web
- . ,
.
Clarion Web- http://www.softvelocity.com. ,
Clarion (, )
(.. Mac OS Linux).

PowerBuilder

PowerBuilder, . -,
PowerBuilder.
PowerBuilder Web- http://www.sybase.com.

& &

,
, .
Linux - ,
, . - ( , ), .
, , .
Internet,
. , .

330

VII.

Internet.
Web-,
.
,
Web-.
V Code Guru (www.codeguru.com). , C/C++, Visual Basic, Java .
^ Planet Source Code (www.planet-source-code.com).
, Visual Basic Java.
S Carl & Gary's Visual Basic Page (www.cgvb.com). , Visual Basic.
S The Delphi Source (www.doit.com/delphi).
, Delphi.
V ABC: All BASIC Code (www.basicguru/abc).
, BASIC, Liberty BASIC, QBASIC, QuickBasic Visual Basic.
s The JavaScript Source (javascript.internet.com).
,
JavaScript.
s The cprogramming.com (www.cprogramming.com). , C/C++.

/^ /
, , .
( , ) ,
, .

, , C/C++, Java Delphi.
Web- , www.microsoft, com www.borland.com.

tfu/nn & Usenet


- .
,
Usenet.
,
. .
,
, .
.
, .
1 </

. land. , .

28.

331

/ . land.basic. , BASIC.
/ conp. land. . , .
S . land. ++. ,
C++.
| V" . land.delphi. ,
, Delphi.
. land, Java .help. , Java.
. land.pascal. ,
Pascal, Delphi.

332

VII.

HTML, 38; 265

, 265
, 276
, 277
, 215

Java, 297
JavaScript
, 294
, 293
, 289
, 291
Java-, 296

Python
, 303
, 305

, 265
, 151

, 201
, 202
, 200
, 201

RAD, 34

, 230
, 38
, 29

-, 296
, 265
, 104
, 34

, 77

, 256
, 255

, 132
, 131
, 132
, 57
, 164

, 107
, 137
, 140
, 80
, 28

, 162
, 162
, 222

DUMP, 78
INPUT, 76
LPRINT, 78
NOMAJNWIN, 75

333


PRINT, 75
PROMPT, 84
SPACES(x), 78
, 80
, 89
, 31; 56

, 42
, 80
, 88

, 197
, 194
, 191
, 193
, 193

, 248
, 246
, 93

, 51
, 50
, 134
, 183
, 54
, 41
, 50
, 54
, 53
, 52
, 52

-, 217
, 131

, 139

, 280
, 97
, 220
, 221
, 222

, 171
, 164

AND, 107
IF THEN, 111
OR, 108
Select Case, 114
XOR, 109
, 107
, 255
, 59
, 77
, 213

, 185
, 186
, 183

II
, 80
, 85
, 78

334

, 143
, 181
, 281, 172
, 176, 283
, 44
, 180
, 178
, 280, 177
, 282, 175

, 242
, 232
, 238
, 235
, 153

, 211
, 212
, 273
, 211
, 275
, 208
, 274
, 212
, 199

, 155
, 155

, 91
, 91

, 204

, 141
, 140
, 140
, 140

X
, 250

, 45

BASIC, 32
, 30
Clarion, 330
FORTRAN, 32
JavaScript, 287
Knowledge Pro, 330
Pascal, 32
PowerBuilder, 330
Python, 302
, 29
, 28
-, 32
, 28

C/C++, 45
Delphi, 47
Java, 47
Liberty BASIC, 67
Visual Basic, 46
, 35
, 44
, 32
Web-, 38
, 36
, 48

335


""

..
..
..
..
.. ..
"".
101509. , . , . 43, . 1.
. . 090230 23.06.99
.
16.07.02. 70x100/16.
Times. .
. . . 27. .-. . 18,5.
. 4000 . 822.
" "
,
.
197110, -, ., 15.

Вам также может понравиться