Write the necessary preprocessor directive to enable the use of the exit function. Write the definition of a function named panic. The function prints the message “unrecoverable error” and then terminates execution of the program, indicating failure..
LANGUAGE: C++
CHALLENGE:
Write the necessary preprocessor directive to enable the use of the exit function. Write the definition of a function named panic. The function prints the message “unrecoverable error” and then terminates execution of the program, indicating failure.
SOLUTION:
void panic(){ cout << "unrecoverable error" << endl; exit (EXIT_FAILURE); }
Posted in C++, Learn To Code