so im extremely rusty in c++ and i have this simple guessing game i want to run. how can i set up the do while loop to get this to keep looping until the number is guessed correctly?
here is my code:
here is my code:
Code:
#include <iostream>
int main (int argc, char * const argv[]) {
// insert code here...
std::cout << "Guess the number I am thinking of, fool\n";
int x;
std::cin >> x;
do
{
if (x == 5)
{
std::cout << "You Guessed it! Go eat a cookie.";
}
else if (x > 2 && x < 8)
{
std::cout << "ooohhh..... almost";
}
else
{
std::cout << "Not even close, fool!!!";
}
return 0;
}
while (x == x);
}
Last edited by a moderator: