MCPcopy Create free account
hub / github.com/Apress/beginning-cpp20 / main

Function main

Examples/NoModules/Chapter 16/Ex16_04/Ex16_04.cpp:6–26  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4#include "Troubles.h"
5
6int main()
7{
8 for (int i {}; i < 7; ++i)
9 {
10 try
11 {
12 if (i == 3)
13 throw Trouble{};
14 else if (i == 5)
15 throw MoreTrouble{};
16 else if (i == 6)
17 throw BigTrouble{};
18 }
19 catch (const Trouble& t)
20 {
21 //std::cout << "Trouble object caught: " << t.what() << std::endl;
22 std::cout << typeid(t).name() << " object caught: " << t.what() << std::endl;
23 }
24 std::cout << "End of the for loop (after the catch blocks) - i is " << i << std::endl;
25 }
26}

Callers

nothing calls this directly

Calls 1

whatMethod · 0.45

Tested by

no test coverage detected