Я читаю один из моих учебников, который плохо объясняет код, который он вводит. Вот пример кода:
int choice;
QString response;
do {
cout << READ << ". Read data from a file.\n"
<< ADD << ". Add items to the Library.\n"
<< FIND << ". Find and display an item.\n"
<< REMOVE << ". Remove an item from the Library.\n"
<< SAVE << ". Save the Library list to a file.\n"
<< LIST << ". Brief listing of Library items.\n"
<< QUIT << ". Exit from this program.\n"
<< "Your choice: " << flush;
response = cin.readLine();
choice = response.toInt();
} while(choice < READ or choice > QUIT)