No idea where the issue is coming from so I will insert the whole sub-routine. When you insert a string into the guess space it will loop infinitly, if you insert a number it will return "ion do you want to go?"(which isn't even written anywhere in the program).
void guess(){
int guess;
string guess2;
string guess_status="";
bool win;
int attempts;
int counter;
int num;
while (guess2 != "exit"){
num=rand() %100 + 1;
win=0;
counter=0;
while (win != 1){
attempts=5-counter;
cout << "Guess a number Attempts Left: " << attempts << endl;
cout << "between 1 and 100 ============================\n The Guesing Game\n ============================" << endl;
cout << "\n" << guess_status << endl;
cout << "\nGuess: ";
cin >> guess;
system("cls");
if (!cin) {
guess2=guess;
if (guess2 != "exit"){
guess_status="Please insert a valid number, restarted game.";
win=1;
}
}
if (cin){
if (guess==num){
win=1;
guess_status="Correct! Generated new number.";
}
if (guess != num){
if (guess < num){
guess_status=num +"was too low!";
}
if (guess > num){
guess_status=num +"was too high!";
}
}
}
}
}
}
The routine is indented, it just didn't paste that way