Hi, I have this "number game" which i just learned tonight ..It runs..but ,not without this warning box poping up, which says: "uninitialized local variable 'guess' used"...This confusing me because i know i did everything exactly like i was taught ...can you find/fix my problem abd explain please it'll be a blessing ...thankyou so much..
#include <iostream>
#include <ctime>
using namespace std;
int main()
{
int random;
int guess;
srand(static_cast<unsigned int>(time(0)));
random = rand()%7+1;
std::cout << "Guess my number! (1-7)\n";
while (guess != random)
{
std::cin >> guess;
std::cin.ignore();
if (guess < random)
{
std::cout << "Too Low!!!\n";
}
if (guess > random)
{
std::cout << "Too High!!!\n";
}
if (guess == random)
{
std::cout << "You Won!!! My number was: "<< random << "\n";
std::cin.get();
}
}
}