02.02.2013 Views

ZX Computings - OpenLibra

ZX Computings - OpenLibra

ZX Computings - OpenLibra

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

String along<br />

with your<br />

friends<br />

Graham Charlton<br />

from Romford<br />

has contributed<br />

some fine utility<br />

programs for the <strong>ZX</strong>81<br />

Telephone<br />

Directory<br />

When you run this program,<br />

you'll be given three options -<br />

update, search or save. Press<br />

ing 1 (update), enables you to<br />

add to your directory. It asks for<br />

the name of the person you<br />

wish to enter, and then the<br />

number. This is converted (see<br />

line 10801 to a 32 character<br />

length string. It is then placed<br />

into your growing directory in<br />

alphabetical order (1190-<br />

1160). The program then requests<br />

another name. Simply<br />

pressing NEWLINE returns you<br />

to the three options.<br />

Entering "2" (search)<br />

16K Program<br />

allows you to search for the<br />

number required. Enter the<br />

name of the person whose<br />

number you want to find, and it<br />

will search for this name, and<br />

print it out. You can have two or<br />

more entries for one person, re.<br />

home and work numbers, the<br />

program will print out all of<br />

them. If you enter "A" then all<br />

the names and numbers of the<br />

people whose name begins<br />

with A in your directory will be<br />

printed out. If you enter BA<br />

you'll get all the names starting<br />

with BA, and so on. Entering a<br />

null string will print out the<br />

whole directory in alphabetical<br />

order. Pressing "3" (save)<br />

saves the enlarged database.<br />

10 GOTO 3000<br />

1000 5CROLL<br />

1 0 1 0 PRINT "MRME TO BE ENTERED?"<br />

1020 INPUT HS<br />

1030 IF M$="" THEN RETURN<br />

1040 SCROLL<br />

1050 PRINT M $; "S NUMBER?"<br />

1060 INPUT N$<br />

1070 LET Ui s=W + 32<br />

1080 LET FT$=H$+M$+" " •' STM<br />

CM$+N$> +N$<br />

1090 LET X =U'<br />

1100 FOR Y=X TO I STEP -32<br />

1 1 1 0 IF FT$T.X TO X + 31.1 IV" TO V"-*-<br />

31) THEN GOTO 1000<br />

112 0 LET B$=ft$(Y TO Y + 32 ><br />

1130 LET ft$ lY TO V>31><br />

+ ol)<br />

=R$ CX TO X<br />

1140 LET ft $ (X TO X+3I)<br />

1150 LET X=Y<br />

=B$<br />

1160 NEXT Y<br />

1170 GOTO 100O<br />

2000 SCROLL<br />

2010 PRINT "NftME TO BE FOUND?"<br />

2O20 INPUT N$<br />

2030 FOR = 1 TO U STEP 3 j<br />

2040<br />

IF ft$ \Z TO<br />

+LEN N$-2.> •: :>NS<br />

THEN GOTO £080<br />

2050 SCROLL<br />

£050 PRINT ft$fZ TO Z+Z±><br />

2070 IF INKEY $ = "O " THEN PRUSE 4-E<br />

4<br />

2030 NEXT Z<br />

2090 SCROLL<br />

2100 PRINT "SEARCH COMPLETED"<br />

2110 RETURN<br />

36<br />

3OO0 SCROLL<br />

3010 PRINT TRB<br />

CTORY"<br />

3 ©3®<br />

3040<br />

3O50<br />

3O60<br />

/ /<br />

SCROLL<br />

PRINT TRB 10; "BY G - CHRRLTOJ'i<br />

LET R$='"<br />

LET U = -31<br />

SCROLL<br />

SCROLL<br />

PRINT "1-UPDRTE 2-SERRC<br />

3-SRUE"<br />

SCROLL<br />

LET 2»=INKEY$<br />

IP Z$ = "" THEN i?DTO 3100<br />

IF Z$>~"1" THEM COSUB 1000<br />

IF Z$="2" THEN GC5L>B £000<br />

IF Z $ = " 3 " THEN "TELEPH<br />

3030<br />

H<br />

3O90<br />

3100<br />

3X10<br />

3120<br />

3130<br />

o!4-0<br />

ONE DIRECTORY"<br />

3150 GOTO 30 P0<br />

String Sort<br />

The title should give away what<br />

this program does. You are<br />

asked how many words you<br />

wish to enter, and the maximum<br />

length of the words. This<br />

sets up a two dimensional strsets<br />

up a two dimensional<br />

string array.<br />

You then enter the words,<br />

the <strong>ZX</strong>81 switches into FAST<br />

and sorts the words into<br />

alphabetical order, switches into<br />

SLOW, and prints out the list.<br />

To print the list onto paper,<br />

delete line 250 and change line<br />

260 to LPRINT A$(A).<br />

<strong>ZX</strong> COMPUTING AUG/SEPT 1982

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!