I need help with my QBasic code here is the problem: In QBasic, create a guessing game. You should have your program to generate a random number from XXXXXXXXXXinclusive). Let the user guess a number...


I need help with my QBasic code here is the problem: In QBasic, create a guessing game. You should have your program to generate a random number from 1-100 (inclusive). Let the user guess a number from 1-100. The program should let the user guess until they get the correct number. After each input, the program should tell the user whether they guessed the correct number, or if they should guess higher or guess lower. While the user is entering guesses, the program should keep a count of the number of guesses that it takes to get the correct number. After the user guesses the correct number, the program should congratulate the user and tell them how many guesses it took them to get the correct number.


This is the code I have so far: DIM range AS INTEGER DIM Guess AS INTEGER


DIM GuessNum AS INTEGER DIM Given AS INTEGER


CLS PRINT "Guessing game “INPUT "Enter range (1-100): “range RANDOMIZE TIMER Given = INT (RND * range) + 1 GuessNum = 0


DO WHILE (Guess GuessNum AND Guess >= 0) INPUT "Enter your guess, or -1 to exit: “Guess GuessNum = GuessNum + 1 IF Guess Given THEN PRINT "It is less" LOOP IF Guess = Given THEN PRINT "Congratulations! You got it in"; GuessNum; "tries."




May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here