10 ' FROM "PROGRAMMING TECHNIQUES FOR LEVEL II BASIC" BY WILLIAM BARDEN 11 ' MODIFIED FOR GW-BASIC BY KINDLY RAT 28 FEB 2003 12 ' INTENDED TO DEMONSTRATE A SEQUENTIAL SEARCH 13 ' ENTER ONE OF THE OBJECTS LISTED AROUND LINE 300 WHEN ASK 14 ' PROGRAM WILL FIND THE OBJECT IN THE ARRAY AND DISPLAY WHERE IT IS 100 CLS 'CLEAR SCREEN 110 DIM A$(20) 'ARRAY FOR DATA 120 FOR I = 0 TO 19 'SETUP FOR DATA TO ARRAY 130 READ B$ 'READ DATA ITEM 140 A$(I) = B$ 'MOVE TO ARRY 150 NEXT I 'CONTINUE TIL DONE 160 INPUT "ITEM FOR SEARCH";C$ 'INPUT ITEM TO BE FOUND 170 CLS 'CLEAR SCREEN 180 FOR I = 0 TO 9 'SETUP LOOP FOR DISPLAY 190 PRINT I, A$(I),, I+10,A$(I+10) 'PRINT IN TWO COLOMS 200 NEXT I 'LOOP 205 PRINT 'SPACE 210 FOR I = 0 TO 19 'SETUP LOOP FOR SEARCH 220 GOSUB 20000 'PRINT ACTION 230 IF C$ = A$(I) GOTO 270 'GO IF FOUND 240 NEXT 'NOT FOUND CONTINUE 250 PRINT "ITEM NOT FOUND " 'PRINT NOT FOUND 260 END 'END IF NOT FOUND 270 PRINT "ITEM FOUND AT "; I 'ITEM FOUND 280 END 'END IF FOUND 300 DATA "ELECTRON","LA SMOG","DIAMOND","PEA","MARBLE" 310 DATA "#3 BEARING","FABERGE EGG","BASEBALL","ORANGE","BOWLING BALL" 320 DATA "BALLON","BALL OF STRING","747 TIRE","DOUGHNUT","GOODYEAR BLIMP" 330 DATA "PERSPHERE","RAMA","PHOBOS","MARS","EARTH" 20000 PRINT "TESTING ENTRY # "; I 'DISPLAY FOR TEST 20030 RETURN 'RETURN TO CALLING PROGRAM