Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- void funcThree()
- {
- std::cout << "funcThree Starts\n";
- throw (float)36.6;
- std::cout << "funcThree Ends\n";
- }
- void funcTwo()
- {
- std::cout << "funcTwo Starts\n";
- try
- {
- funcThree();
- }
- catch (char ex)
- {
- std::cout << "funcTwo catches char exception\n";
- }
- std::cout << "funcTwo Ends\n";
- }
- void funcOne()
- {
- std::cout << "funcOne Starts\n";
- try
- {
- funcTwo();
- }
- catch (float ex)
- {
- std::cout << "funcOne catches float exception\n";
- }
- catch (bool ex)
- {
- std::cout << "funcOne catches bool exception\n";
- }
- catch (int ex)
- {
- std::cout << "funcOne catches int exception\n";
- }
- std::cout << "funcOne Ends\n";
- }
- int main()
- {
- std::cout << "Program starts\n";
- try
- {
- funcOne();
- }
- catch (float ex)
- {
- std::cout << "main catches float exception\n";
- }
- catch (double ex)
- {
- std::cout << "main catches double exception\n";
- }
- catch (int ex)
- {
- std::cout << "main catches int exception\n";
- }
- std::cout << "Program ends\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement