Answer the question
In order to leave comments, you need to log in
How to write goto in ternary operator?
bool fiftyOnFifty = true;//подсказка "50/50"
getAnswer: cout << "\nInput symbol of answer: ";
cin >> userAnswer;
if(!((userAnswer >= '1' && userAnswer <= '3') || (userAnswer >= 'a' || userAnswer <= 'd')))//пользователь должен ввести символ с диапазонов '1'-'3' и 'a'-'d'
{
goto getAnswer;
}
if(userAnswer == '1')//если пользователь выбрал подсказку "50/50"
{
(fiftyOnFifty) ? fiftyOnFiftyFunc() : goto getAnswer;
}
Answer the question
In order to leave comments, you need to log in
The use of goto is bad manners.
do {
cout << "\nInput symbol of answer: ";
cin >> userAnswer;
if (userAnswer == '1') {
fiftyOnFiftyFunc();
}
} while (userAnswer != '2' && userAnswer != '3' &&
(userAnswer < 'a' || userAnswer > 'd'));
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question