Я не могу заставить эти инструкции if работать по назначению. Независимо от того, что я вводил в «строковый ответ», он всегда перескакивает в первый оператор IF, где условие задается только для выполнения блока, если ответ точно «n» или «N» или блок, где ответ точно «y», или "Y". Если вы наберете в чем-то он должен возвращать 0.Не может показаться, что моя инструкция IF корректно работает
// Game Recap function, adds/subtracts player total, checks for deposit total and ask for another round
int gameRecap() {
string answer;
answer.clear();
cout << endl << "---------------" << endl;
cout << "The winner of this Game is: " << winner << endl;
cout << "Player 1 now has a total deposit of: " << deposit << " credits remaining!" << endl;
cout << "-------------------------" << endl;
if (deposit < 100) {
cout << "You have no remaining credits to play with" << endl << "Program will now end" << endl;
return 0;
}
else if (deposit >= 100) {
cout << "Would you like to play another game? Y/N" << endl;
cin >> answer;
if (answer == ("n") || ("N")) {
cout << "You chose no" << endl;
return 0;
}
else if (answer == ("y") || ("Y")) {
cout << "You chose YES" << endl;
currentGame();
}
else {
return 0;
}
return 0;
}
else {
return 0;
}
return 0;
}
Прекрасно работает, спасибо! – Sauceman