bobbynichols

Members
  • Content Count

    1750
  • Joined

  • Last visited

Posts posted by bobbynichols

  1. Very nice.

    I finally found a freeware QBasic proggy at http://www.winsite.com/bin/Info?2000000035557 and jcl's first prog works fine.

    I also have a freeware proggy called Just Basic v. 1.0 that I picked up somewhere that had this exercise as a tutorial program:

     ' Here is an interactive HI-LO
    ' Program

    [start]
    guessMe = int(rnd(1)*1000) + 1

    ' Clear the screen and print the title and instructions
    cls
    print "HI-LO"

    print

    print "I have decided on a number between one"
    print "and a thousand, and I want you to guess"
    print "what it is. I will tell you to guess"

    print "higher or lower, and we'll count up"
    print "the number of guesses you use."

    print

    [ask]
    ' Ask the user to guess the number and tally the guess
    input "OK. What is your guess?"; guess

    ' Now add one to the count variable to count the guesses
    let count = count + 1

    ' check to see if the guess is right
    if guess = guessMe then goto [win]
    ' check to see if the guess is too low
    if guess < guessMe then print "Guess higher."

    ' check to see if the guess is too high
    if guess > guessMe then print "Guess lower."

    ' go back and ask again
    goto [ask]

    [win]
    ' beep once and tell how many guesses it took to win
    beep
    print "You win! It took "; count; " guesses."

    ' reset the count variable to zero for the next game
    let count = 0

    ' ask to play again
    input "Play again (Y/N)"; play$
    if instr("YESyes", play$) > 0 then goto [start]

    print "Press ALT-F4 to close this window."

    end

    It's interesting to see the differences between the various types of BASIC that have evolved.

  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.

    ... What's a higer ?

  3. ... Kentucky

    bourban

    My old friend Jim Beam :D

    ... "I Drink Alone" - George Thorogood

    "I drink alone, yeah, with nobody else.

    I drink alone, yeah, with nobody else.

    Yeah, you know when I drink alone, I prefer to be by myself.

    Now, every morning, just before breakfast,

    I don't want no coffee or tea.

    Just me and my good buddy Weiser.

    That's all I ever need.

    Cause I drink alone, yeah, with nobody else.

    I drink alone, yeah, with nobody else.

    Yeah, you know when I drink alone, I prefer to be by myself.

    Now, the other night I lay sleeping,

    And I woke from a terrible dream.

    So I called up my pal, Jack Daniels,

    And his partner Jimmy Beam.

    And we drank alone, yeah, with nobody else.

    We drank alone, yeah, with nobody else.

    Yeah, you know when I drink alone, I prefer to be by myself.

    Well, the other night I got invited to a party,

    But I stayed home instead.

    Just me and my pal Johnny Walker,

    And his brothers Black and Red.

    And we drank alone, yeah, with nobody else.

    We drank alone, yeah, with nobody else.

    Yeah, you know when I drink alone, I prefer to be by myself.

    Well, my whole family done give up on me,

    And it makes me feel so bad.

    The only one who'll hang out with me

    Is my dear old Granddad.

    And we drink alone, yeah, with nobody else.

    We drink alone, yeah, with nobody else.

    Yeah, you know when I drink alone, I prefer to be by myself. "