MCPcopy Create free account
hub / github.com/EricPengShuai/Interview / temperature

Function temperature

practice/exception.cpp:8–25  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6using namespace std;
7
8void temperature(int t)
9{
10 try{
11 if (t==100) {
12 throw "It's at the boiling point.";
13 } else if (t==0) {
14 throw "It reached the freezing point.";
15 } else {
16 cout << "the temperature = "<< t << endl;
17 }
18 }
19 catch(int x) {
20 cout << "temperature=" << x << endl;
21 }
22 catch(char const*s) {
23 cout << s << endl;
24 }
25}
26
27void handler(int n) throw(int, char, double) {
28 if (n==1) throw n;

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected