
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); }
Fixed for those leaving thumbs down without looking at the code at all
void panic()
{
cout << "unrecoverable error" << endl;
exit (EXIT_FAILURE);
}