MCPcopy Create free account
hub / github.com/ShiqiYu/CPP / ratio_wrapper

Function ratio_wrapper

week14/examples/error5.cpp:17–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15}
16
17float ratio_wrapper(float a, float b)
18{
19 try{
20 return ratio(a, b);
21 }
22 catch(int eid)
23 {
24 if (eid == 1)
25 std::cerr << "Call ratio() failed: the 1st argument should be positive." << std::endl;
26 else if (eid == 2)
27 std::cerr << "Call ratio() failed: the 2nd argument should be positive." << std::endl;
28 else
29 std::cerr << "Call ratio() failed: unrecognized error code." << std::endl;
30 }
31 return 0;
32}
33
34int main()
35{

Callers 1

mainFunction · 0.85

Calls 1

ratioFunction · 0.70

Tested by

no test coverage detected