Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Search inside Integers
#6
If it is inputting a sring I probably should have done this:

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
Reply


Messages In This Thread
Search inside Integers - by techdude2007 - 05-11-2008, 03:44 AM
Re: Search inside Integers - by roy - 05-11-2008, 04:19 AM
Re: Search inside Integers - by Ralph - 05-11-2008, 09:34 AM
Re: Search inside Integers - by LPG - 05-11-2008, 09:51 AM
Re: Search inside Integers - by Ralph - 05-11-2008, 11:14 AM
Re: Search inside Integers - by LPG - 05-12-2008, 10:54 AM
Re: Search inside Integers - by Ralph - 05-12-2008, 08:45 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)