Hello, I am new at c++ and need some help.
The project we were given is to write a program that asks the user to think of a number between 1 and 100, then attempts to guess the number. The program should make an initial guess of 50. The program should then ask the user if 50 is the number the user has in rnind, or if 50 is too high or too low Based on the response given by the user, the program should make another guess. Your program must conthue to guess until the correct number is reached.
I am really stumped on this project. I have the basic logic down but I am missing things, and am not sure how to even contiune or what to put where.. If you can help me figure this out in anyway it would be much appreciated. Thanks c:
This is what I have so far...
// Project 8.4. Guess the number the user enters between 1-100.
#include <iostream>
using namespace std;
int UsersNum, YesNo, HighLow, High, Low, Yes, No;
int main ()
{
cout << "Welcome to the number guessing game. I will try and guess the number you will enter. \n";
cout << "Please enter a number between 1 -100. \n";
cin >> UsersNum;
cout << "Is your number 50? Yes or No? \n";
cin >> YesNo;// enter if 50 is correct
if ( YesNo = Yes) // if user answers yes
cout << "I guessed your number! Game Over \n";
if ( YesNo = No)// if user answers no
cout << "Is 50 too high or too low? \n";
cin >> HighLow;
if (HighLow = High)
// Guess a lower number
cout << "Is this the number you entered? Yes or No? \n";
cin >> YesNo;
if (HighLow = Low)
// Guess a lower number
cout << "Is this the number you entered? Yes or No? \n";
cin >> YesNo;
if (YesNo = Yes)
cout << "I have guessed your number! \n";
if (YesNo = No)
// repeat high or low part
return 0;
}