Reply To: C++ abrupt termination

Home Forums C Programming C++ abrupt termination Reply To: C++ abrupt termination



Yes I got the same error, this is not the compiler or OS error. Actually the variable choice in your program is of type int. And you use that variable to get the input from the user to make the decision and navigate through the menu. So now the problem is when enters character instead of an integer value, it crashes your program.

So the solution to your problem is that you will have to check this input first, whether the choice is of type integer or character. If its of character type then ignore it, as you are doing cin.ignore(); but you will have to implement it properly. As cin.ignore(); ignores characters only.