out_func.cpp
来自「不错书对C++/C程序员很有用的大家不要错过.」· C++ 代码 · 共 25 行
CPP
25 行
#include <iostream.h>
void XHandler(int test)
{
cout << "Inside XHandler, test is:" << test << endl;
if(test) throw test;
}
void main(void)
{
cout << "Start: " << endl;
try {
cout << "Inside try block." << endl;
XHandler(1);
XHandler(2);
XHandler(0);
}
catch(int i) {
cout << "Caught an exception. Value is: ";
cout << i << endl;
}
cout << "End";
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?