Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

write a pseudocode for this program //header files #include #include #include //time using namespace std; //main function int main() { int number, i; char ans;

write a pseudocode for this program

//header files #include #include #include //time using namespace std; //main function int main() { int number, i; char ans; srand(time(NULL)); //creating random number between 1 to 50 number = 1 + rand()%50; //printing the random number to identify the guess int guess; int count=0; do { cout<<"I'm thinking of a number.Guess a Value(1-50): "; do { //enter a guess cin>>guess; //if guess is equal to number if(guess == number) { cout<<"Correct!You got it in "<0 && guess <=50) { count++; cout<<"Too low!.Guess again: "; } //if guess is greater than number else if(guess > number && guess >0 && guess <= 50) { count++; cout<<"Too High.Guess again: "; } //if guess in not in valid range else if(guess<0 || guess> 50) { count++; cout<<"Invalid!Try again: "; } }while(guess != number); cout<<"Do you want to continue y/Y?: "; cin>>ans; if(ans != 'y' && ans != 'Y') { break; } }while(ans == 'y' || ans == 'Y'); return 0; }//end program

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Azure SQL Database For Modern Developers Building Applications In The Microsoft Cloud

Authors: Davide Mauri, Silvano Coriani, Anna Hoffma, Sanjay Mishra, Jovan Popovic

1st Edition

1484263693, 978-1484263693

Students also viewed these Databases questions

Question

Evaluate 3x - x for x = -2 Answer:

Answered: 1 week ago

Question

What is group replacement? Explain with an example. (2-3 lines)

Answered: 1 week ago