Need Help With Guessing Game

I neeed to Create a guessing game with numbers between 1 and 100. The loop will never exit until the condition is met. The user will continually guess and display:
Sorry Too Low
Sorry Too High
You Guessed Right

** YOU MUST USE THE BOOLEAN VARIABLE… when the boolean is true, the loop will exit **

This is what i got so far;
//Assignment 10 Program 1
#include <iostream>
using namespace std;

int main()
{
//Declaring Varibles
int guess=50,x;
cout << "This program is a random guessing game."<<endl;
do
{
cout << "Enter your guess (1-100): ";
cin >> guess;

if ( guess < 49 )
{
cout << "Too Low, Try Again." << endl;
}
else if ( guess > 51 )
{
cout << "Too High, Try Again" << endl;
}

else if ( guess == guess )
{
cout << "Congratulations, You Figured Out My Number." << endl;
break;
}
} while ( guess = guess );
//Error Handling
else { (x!=guess);
cout << "Error Invaild Input"<<endl;
}
system ("pause");
return 0;
}
Last edited on
No one is going to do your homework for you. Post your code you've written so far, and we will help you.
my bad , forgot to post it ^
Topic archived. No new replies allowed.