Hi,
I have a method to read input from a user like this
int cmd = 0;
while (true) {
try {
cout << "Menu of options: 1) New game 2) Mark 3) Status 4) Exit";
cin >> cmd;
}
catch (?????) {
cout<<"Invalid input. Try again"<<endl;
continue;
}
}
I am using a try and catch block in case the user types a string or a non-numeric character. In that case I would like in the catch to just print the message and ask again.
What are the arguments to the catch? Do I need to include any exception library?
Thanks
Debbie
I have a method to read input from a user like this
int cmd = 0;
while (true) {
try {
cout << "Menu of options: 1) New game 2) Mark 3) Status 4) Exit";
cin >> cmd;
}
catch (?????) {
cout<<"Invalid input. Try again"<<endl;
continue;
}
}
I am using a try and catch block in case the user types a string or a non-numeric character. In that case I would like in the catch to just print the message and ask again.
What are the arguments to the catch? Do I need to include any exception library?
Thanks
Debbie