Advertisement
microwerx

CS 202 Exceptions.cpp

May 6th, 2020
1,191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. void functionC()
  4. {
  5.   //your code here
  6. }
  7.  
  8. void functionB()
  9. {
  10.   //your code here
  11.   std::cout << "Starting functionB()\n";
  12.   functionC();
  13.   std::cout << "Ending functionB()\n";
  14. }
  15.  
  16. void functionA()
  17. {
  18.   // your code here
  19.   functionB();
  20.   // your code here
  21.   std::cout << "Caught an exception: " << e.what() << std::endl;
  22.   // your code here
  23. }
  24.  
  25. int main()
  26. {
  27.   std::cout << "Starting main()" << std::endl;
  28.   functionA();
  29.   std::cout << "Ended normally." << std::endl;
  30.   return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement