I have a char variable with the name of the entrance, the user must enter Y / N, if something else is entered, you must display a message about the incorrectness of the entered data and ask to enter again, until Y / N is entered or y / n. For some reason, I have a cycle of an error message that displays as much as the wrong characters I type, and I can’t understand why.
Here is the code itself:
char entrance; cin >> entrance; while((entrance != 78) && (entrance != 110) && (entrance != 89) && (entrance != 121)) { cout << "Неверный ввод! Следует ввести Y/N, попробуйте еще раз:"; cin >> entrance; cout << "" << endl; } In general, I am not even sure of the correctness of this approach, this is only a small part of a large OOP assignment. It is necessary to create a program for booking a hotel and this small part of the code is responsible for the continuation of the program, depending on the data entry.
while((entrance != 'y') && (entrance != 'Y') && (entrance != 'n') && (entrance != 'N'))? - Harry