Question: 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

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!