I need the following pseudocode to work and run in a C++ compilier // Pseudocode
ID: 670291 • Letter: I
Question
I need the following pseudocode to work and run in a C++ compilier // Pseudocode PLD #6, pg. 117 // // Start // Declarations // number numberToGuess // number myGuess; // // numberToGuess = 92 // while myGuess != numberToGuess // output "Please guess an integer number between 1 and 100" // input myGuess // if (myGuess == numberToGuess) // output "You guessed the correct number" // else // output "The number you guessed was incorrect. Try again!" // end if // end while // output "Thanks for playing the guessing game. Have a great day!" // Stop
Explanation / Answer
#include<iostream.h>
#include<conio.h>
void main()
{
int numberToGuess, myGuess;
clrscr();
numberToGuess = 92;
while (myGuess != numberToGuess)
{
cout<<"Please guess an integer number between 1 and 100";
cin>> myGuess;
if (myGuess == numberToGuess)
{
cout<< "You guessed the correct number";
}
else
{
cout<< "The number you guessed was incorrect. Try again!";
}
cout<< "Thanks for playing the guessing game. Have a great day!";
}
getch();
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.