I know a poor way of doing it:
QTextStream cin(stdin);
QString choice = cin.readLine();
if (choice == "yes" || choice == "y") {...
I'd like though to do it where when it shows up in cmdline:
Accept quest? (y/n)
y
Where:
- y is displayed by default
- If you press n, it will not go "yn", but just change the character to "n"
If you press any letter besides y or n, they won't register.
And maybe as a bonus, if you press y,
Yes!
is displayed, and if you press n,No.
is displayed.
Thanks!