📄 ex14002.cpp
字号:
// Programming with C++ by John R. Hubbard
// Copyright McGraw-Hill, 1999
// Example 14.1 on page
#include <iostream>
using namespace std;
void f(string);
int main()
{ string x = "****";
try
{ cout << "Now trying to call f(x):" << endl;
cout << "Passing argument x = " << x << endl;
f(x);
}
catch(string e)
{ cout << "Exception object e was caught:" << endl;
cout << "The object e = " << e << endl;
}
}
void f(string xx)
{ cout << " f(xx) is now executing." << endl;
cout << " Its parameter xx = " << xx << endl;
string ee = "!!"+xx+"!!";
cout << " Created object ee = " << ee << endl;
cout << " Now throwing ee as an exception." << endl;
throw ee;
cout << " THIS LINE SHOULD NOT EXECUTE!" << endl;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -