TrueBasic - why is this not working? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

TrueBasic - why is this not working?

weedude999weedude999 Posts: 1Member
Sorry for the lack of comments, Im just fiddling around with this program that I am going to have to write in class tomorrow... At the bits highlighted in blue I get the error "must be a number"
all help is appreciated.



LOCAL difficulty$, guess, integer

DECLARE DEF higher_or_lower

DO
INPUT PROMPT ("Would you like to play guess number on easy, medium or hard?"): difficulty$
Select Case difficulty$
Case "easy"

RANDOMIZE
LET integer = int(20*rnd)
DO
DO
INPUT PROMPT ("Guess a number between one and twenty") : guess
LOOP UNTIL guess => 0 AND guess <= 20
CALL higher_or_lower (guess, integer)
LOOP UNTIL guess = integer

Case "medium"
RANDOMIZE
LET integer = int(50*rnd)
DO
DO
INPUT PROMPT ("Guess a number between one and fifty") : guess
LOOP UNTIL guess => 0 AND guess <= 50
CALL higher_or_lower (guess, integer)
LOOP UNTIL guess = integer

Case "hard"
RANDOMIZE
LET integer = int(100*rnd)
DO
DO
INPUT PROMPT ("Guess a number between one and a hundred") : guess
LOOP UNTIL guess => 0 AND guess <= 100
CALL higher_or_lower (guess, integer)
LOOP UNTIL guess = integer

CASE ELSE
PRINT "Error. Try again."
End SELECT
LOOP UNTIL difficulty$ = "easy" OR difficulty$ = "medium" OR difficulty$ = "hard"

END

SUB higher_or_lower (guess, integer)
SELECT CASE guess
[color=Blue]CASE IS < integer[/color]
PRINT "The number is higher. "
[color=Blue]CASE IS > integer [/color]
PRINT "The number is lower. "
CASE ELSE
END SELECT
END SUB


Sign In or Register to comment.