Question: // Note: - I supposed to use while and if loop and same way the pseudocode the instructor gave us. can you show me i

 // Note: - I supposed to use while and if loop

// Note: - I supposed to use while and if loop and same way the pseudocode the instructor gave us. can you show me i add an output file .txt

#include #include #include using namespace std;

int main() { const int MAX_NUM = 100, // const for upper limit MIN_NUM = 1; // const for kower limit unsigned seedNum; // var for seed number (warning unsigned) int randNum, // var for rand number guessNum; // var for guessed number

// gen rand number, store rand number seedNum = time(0); // grab a number based on time srand(seedNum); // scramble randNum = rand() % MAX_NUM + 1; // get rand number // Remove : cout randNum cout

// explain the rules // cout, cin and Q&A

//loop for guessing while (guessNum != randNum && guessNum MAX_NUM) //three paths: 1) guess is too low, 2) guess is too high, 3) guessed //if (guessNum randNum) "too high, try again" //else (guessNum == randNum) "Congrats, you got it " // end if

//thanks for playing //end loop

// 1) get it to work perfect // 2) code for output file system("pause"); return 0; }

12. Random Number Guessing Game Write a program that generates a random number between 1 and 100 and asks the user to guess what the number is. If the user's guess is higher than the random number, the program should display "Too high. Try again. If the user's guess is lower than the random number, the program should display "Too low. Try again. The program should use a loop that repeats until the user correctly guesses the random number. Then the program should display Congratulations. You figured out my number

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!