#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int main()
{
int num;
int guess;
int noOfGuesses;
bool done;
cout << "Ready to Play the Guessing Game?" << endl;
cout << "Think you can beat me? You have 5 Guesses!" << endl;
num = (rand() + time(0)) % 100;
done = false;
while ((noOfGuesses < 5) && (!done))
{
cout << "Enter an integer that is between 0 and 100";
cin >> guess;
cout << endl;
noOfGuesses++;
if (guess == num)
{
cout << "Winner! You guessed the correct number!" << endl;
done = true;
}
else if (guess < num)
cout << "Your guess is lower then the number.\n" "Guess again!" << endl;
else
cout << " Your guess is higher then the number.\n" "Guess again!" << endl;
}
if (!done)
cout << "^_^ I win, the number is " << num << endl;
return 0;
}
Guessing Game program needs to limit the user to only 5 guesses, recieves runtime error can anyone exsplain to me why ?