05-12-2008, 10:54 AM
If it is inputting a sring I probably should have done this:
this checks the user inputs a number. the previous version would count the "5"'s in a phrase.
Code:
CLS ' 5 finder.v2
NUMBER$ = "1234567890"
IN:
INPUT "PLEASE ENTER A NUMBER";A$
FOR B = 1 TO LEN(A$)
NUM = 0
FOR C = 1 TO 10
 IF MID$(A$,B,1) = MID$(NUMBER$,C,1) THEN NUM = 1
NEXT
IF NUM <> 1 THEN PRINT "YOU DIDN'T TYPE A NUMBER." : GOTO IN
NEXT
S$ = "5"
1 IF INSTR(A$,S$) <> 0 THEN : TOT = TOT + 1 : A$ = RIGHT$(A$,LEN(A$)-INSTR(A$,S$)) : GOTO 1
PRINT "THERE ARE ";TOT;" ";CHR$(34); S$ ; CHR$(34);"'S"
SYSTEM
this checks the user inputs a number. the previous version would count the "5"'s in a phrase.
WHILE RPG$ <> "complete" : make up silly excuses :WEND