Howdy, Stranger!

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

need help with a program for school

Member Posts: 1
i need help with a qbasic program i'm working on for school..i kno it seems easy, but for some reason it just isnt working...if someone could take a look and post some help, or email it to me at [email protected], i would really really appreciate it. neway, here's the scope of the program and what he wants it to do:

This program is a high/low numbers game without a Hall of Fame. This option will be added later in Program 5.

The computer will select a random number between 1 and 100 and do some preliminary housekeeping functions, then it will beep.

The computer will then display the message: Please enter a number between 1 and 100.

The program will add one to a counter and determine if the user response is indeed between 1 and 100, if not, an error message is displayed, and the user is instructed to select another number between 1 and 100 again adding one to the counter.

Once the players number is determined to be between 1 and 100, the program calculates to see if the player's number is equal to the computer's number.

If the numbers match, then the player wins and the number of tries is displayed using the message "Congratulations, you guessed the number in (number of tries) tries". The program now asks if the user would like to replay. If the user response is yes, then the program is restarted. If not, the program ends with the message "Thank you for playing" on the monitor.

If the numbers do not match, the program determines if the number is within 10 less than and 10 more than the computer generated number. If so, the computer displays the number entered and the message "Your getting hot", and goes back and asks for another number from the user. If not, the message Your cold is displayed, and the program goes back and askes for another number.

• Member Posts: 595
Nothiong easyer, I don't think Advanced Qbasic message board it the place for that question.

I never make home work for anyone, I can only give you some tips:

1. make a loop, first it calls the game function, and then it ask the user if he want to play again.

2. Game function, first it should get a random routine, than an other loop where the computer ask the user for input, check if 0 <= input <= 100, if true then check if it's a good number if true then tell it to him and exit the sub, if it's not the good number it checks if his answer was close to the number to guess, if so then tell him he is.

You will need for this program:
PRINT, IF THEN ELSE, DO LOOP, RANDOMIZE TIMER, RND, INT, INPUT, and a Game Function.
• USAMember Posts: 4,624 ✭✭

____ || http://forcoder.org || free ebooks and video tutorials about | JavaScript, C++, Ruby, C#, Delphi, PHP, Objective-C, Perl, R, PL/SQL, Go, Swift, Visual Basic .NET, Scratch, MATLAB, C, Python, Visual Basic, Assembly, Java Crystal, Ada, Scala, Lua, Clojure, Scheme, Fortran, D, Hack, SAS, F#, Awk, Alice, Dart, FoxPro, Rust, VBScript, Logo, ML, Transact-SQL, Prolog, Lisp, Kotlin, LabVIEW, Bash, Julia, Erlang, ABAP, COBOL, Apex | _