microwerx icon

CS 202 Exceptions.cpp

microwerx | PRO | 05/06/20 07:07:22 PM UTC | 0 ⭐ | 1486 👁️ | Never ⏰ | []
C++ |

510 B

|

None

|

0 👍

/

0 👎

#include <iostream>
 
void functionC()
{
  //your code here
}
 
void functionB()
{
  //your code here
  std::cout << "Starting functionB()\n";
  functionC();
  std::cout << "Ending functionB()\n";
}
 
void functionA()
{
  // your code here
  functionB();
  // your code here
  std::cout << "Caught an exception: " << e.what() << std::endl;
  // your code here
}
 
int main()
{
  std::cout << "Starting main()" << std::endl;
  functionA();
  std::cout << "Ended normally." << std::endl;
  return 0;
}

Comments