Jump to content
  • Advertisement
Sign in to follow this  
camdaman

a beginner with a confusing question.

This topic is 4727 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I need some help with this code. It never says "guess higher" even when u guess the number 1. (i used blitz basic) ;CAMERONS's guessing game v3.0 Function SCR() Delay 200 End Function ESC=1 Print "S" SCR() Print "C" SCR() Print "R" SCR() Print "O" SCR() Print "L" SCR() Print "L" SCR() Print " " SCR() Print "D" SCR() Print "O" SCR() Print "W" SCR() Print "N" Print "STOP!" Print"PRESS ANY KEY" WaitKey() Cls ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Print "WELCOME" AppTitle "CAMERON'S GUESSING GAME" SeedRnd MilliSecs() N2G=Rand(1-100) NOG=NOG+1 Repeat GUESS=Input("GUESS A NUMBER BETWEEN 1 AND 100 ") If GUESS>100 Or GUESS < 1 Print ("PICK A NUMBER BETWEEN 1 AND 100 ") ElseIf GUESS < N2G Print "GUESS HIGHER DOWG " ElseIf GUESS > N2G Print "GUESS LOWER MAN " EndIf Until GUESS=N2G Cls Print "YOU GUESSED THE NUMBER "+N2G+" IN "+NOG+" TRIES " While Not KeyHit(ESC) Print "PRESS ESC TO EXIT" SCR() Wend It keeps saying things like"elseif without if" and endif without if thanks in advance

Share this post


Link to post
Share on other sites
Advertisement
Never used Blitz Basic, but a little googling makes me think this is atleast one of your culprits:

N2G=Rand(1-100)

Shouldn't that be: N2G=Rand(1,100)

?

Share this post


Link to post
Share on other sites
I'm also not familiar with Blitz Basic, but try putting parenthesis around the Or clause in the if statement:

If (GUESS > 100 Or GUESS < 1)


You mentioned that it was giving errors - can you post the exact error message it produces? Does it indicate what line caused the error?

Share this post


Link to post
Share on other sites
Quote:
Original post by ApochPiQ
I'm also not familiar with Blitz Basic, but try putting parenthesis around the Or clause in the if statement:

If (GUESS > 100 Or GUESS < 1)


You mentioned that it was giving errors - can you post the exact error message it produces? Does it indicate what line caused the error?


Thanks ApochPiQ...THat Helped

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!