confusedguy

Members
  • Content Count

    2
  • Joined

  • Last visited

Posts posted by confusedguy

  1. Alright, so i have this assignment for a class, and i have what i hope to be most of it done, but i just cant seem to figure out how to do a certain part of it.

    the assignment calls for making a program where a random number is generated and the user gets a chance to input a guess. the program will then print out if the guess is lower or higher or the same as the random number. and if it isent the same, it alows them to continue to guess untill they get it right.

    so far i have been able to get the random number generated and for it to tell you if your guess is higher lower or the same. but i cant figure out how to get it to allow the user to continue to guess without re-starting the program and thus getting a compleatly different random number.

    here is my code so far.

    DIM guess AS SINGLE

    DIM higer AS STRING

    DIM lower AS STRING

    RANDOMIZE TIMER

    INPUT "Please enter in your guess: ", guess

    secretnum = INT(1000 * RND + 1)

    IF guess > secretnum THEN

    PRINT "Lower"

    IF guess < secretnum THEN

    PRINT "Higher"

    IF guess = secretnum THEN

    PRINT "You got it!"

    END IF

    END IF

    END IF

    i am pretty sure i have to put in a DO WHILE or DO UNTIL loop. but whenever i try to put one in it gives me either an error saying that its a loop or do without the other. and if it dosent give me that error message, then it just allows me to enter my first guess and nothing else. dosent even print out if its higher lower or if i guess it correctly.

    please, im not asking for anyone to do this for me, but i have been trying to figure this out for hours, and im about to burn out. i just need someone to either tell me how to make it loop, or at least send me in the right direction.

    thanks.

    alright, so i just got a loop to work with it, but now after i enter in the first value, it either just continues to let me enter in guesses without telling me if its higher or lower. or it keeps sayin lower until once again, it just stops telling me. why is that happening?

    here is my updated code.

    CLS

    DIM secretnum AS SINGLE

    DIM guess AS SINGLE

    DIM higer AS STRING

    DIM lower AS STRING

    RANDOMIZE TIMER

    secretnum = INT(1000 * RND + 1)

    WHILE secretnum <> guess

    INPUT "Please enter in your guess: ", guess

    IF guess > secretnum THEN

    PRINT "Lower"

    IF guess < secretnum THEN

    PRINT "Higher"

    IF guess = secretnum THEN

    PRINT "You got it!"

    END IF

    END IF

    END IF

    wend

    once again, any help is VERY appriciated.

    ... What's a higer ?

    its simply a typo. its ment to say higher

  2. Alright, so i have this assignment for a class, and i have what i hope to be most of it done, but i just cant seem to figure out how to do a certain part of it.

    the assignment calls for making a program where a random number is generated and the user gets a chance to input a guess. the program will then print out if the guess is lower or higher or the same as the random number. and if it isent the same, it alows them to continue to guess untill they get it right.

    so far i have been able to get the random number generated and for it to tell you if your guess is higher lower or the same. but i cant figure out how to get it to allow the user to continue to guess without re-starting the program and thus getting a compleatly different random number.

    here is my code so far.

    DIM guess AS SINGLE

    DIM higer AS STRING

    DIM lower AS STRING

    RANDOMIZE TIMER

    INPUT "Please enter in your guess: ", guess

    secretnum = INT(1000 * RND + 1)

    IF guess > secretnum THEN

    PRINT "Lower"

    IF guess < secretnum THEN

    PRINT "Higher"

    IF guess = secretnum THEN

    PRINT "You got it!"

    END IF

    END IF

    END IF

    i am pretty sure i have to put in a DO WHILE or DO UNTIL loop. but whenever i try to put one in it gives me either an error saying that its a loop or do without the other. and if it dosent give me that error message, then it just allows me to enter my first guess and nothing else. dosent even print out if its higher lower or if i guess it correctly.

    please, im not asking for anyone to do this for me, but i have been trying to figure this out for hours, and im about to burn out. i just need someone to either tell me how to make it loop, or at least send me in the right direction.

    thanks.

    alright, so i just got a loop to work with it, but now after i enter in the first value, it either just continues to let me enter in guesses without telling me if its higher or lower. or it keeps sayin lower until once again, it just stops telling me. why is that happening?

    here is my updated code.

    CLS

    DIM secretnum AS SINGLE

    DIM guess AS SINGLE

    DIM higer AS STRING

    DIM lower AS STRING

    RANDOMIZE TIMER

    secretnum = INT(1000 * RND + 1)

    WHILE secretnum <> guess

    INPUT "Please enter in your guess: ", guess

    IF guess > secretnum THEN

    PRINT "Lower"

    IF guess < secretnum THEN

    PRINT "Higher"

    IF guess = secretnum THEN

    PRINT "You got it!"

    END IF

    END IF

    END IF

    wend

    once again, any help is VERY appriciated.