B
This commit is contained in:
parent
e5e8880e41
commit
518da4a923
1019 changed files with 15877 additions and 0 deletions
21
Task/Search-a-list/BBC-BASIC/search-a-list.bbc
Normal file
21
Task/Search-a-list/BBC-BASIC/search-a-list.bbc
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
DIM haystack$(27)
|
||||
haystack$() = "alpha","bravo","charlie","delta","echo","foxtrot","golf", \
|
||||
\ "hotel","india","juliet","kilo","lima","mike","needle", \
|
||||
\ "november","oscar","papa","quebec","romeo","sierra","tango", \
|
||||
\ "needle","uniform","victor","whisky","x-ray","yankee","zulu"
|
||||
|
||||
needle$ = "needle"
|
||||
maxindex% = DIM(haystack$(), 1)
|
||||
|
||||
FOR index% = 0 TO maxindex%
|
||||
IF needle$ = haystack$(index%) EXIT FOR
|
||||
NEXT
|
||||
IF index% <= maxindex% THEN
|
||||
PRINT "First found at index "; index%
|
||||
FOR last% = maxindex% TO 0 STEP -1
|
||||
IF needle$ = haystack$(last%) EXIT FOR
|
||||
NEXT
|
||||
IF last%<>index% PRINT "Last found at index "; last%
|
||||
ELSE
|
||||
ERROR 100, "Not found"
|
||||
ENDIF
|
||||
2
Task/Search-a-list/Burlesque/search-a-list-1.blq
Normal file
2
Task/Search-a-list/Burlesque/search-a-list-1.blq
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
blsq ) {"Zig" "Zag" "Wally" "Bush" "Ronald" "Bush"}"Bush"Fi
|
||||
3
|
||||
2
Task/Search-a-list/Burlesque/search-a-list-2.blq
Normal file
2
Task/Search-a-list/Burlesque/search-a-list-2.blq
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
blsq ) {"Zig" "Zag" "Wally" "Bush" "Ronald" "Bush"}{"Bush"==}fI
|
||||
{3 5}
|
||||
Loading…
Add table
Add a link
Reference in a new issue