📄 pr25006.cpp
字号:
////////////////////////////////////////
// File Name: pr25006.cpp
////////////////////////////////////////
#include <iostream>
#include <cstdlib>
#include <exception>
// Exception class declarations.
class Bummer {};
class Killer {};
////////////////////////////////////////
// Catch uncaught exceptions.
////////////////////////////////////////
void terminator_2()
{
std::cout << "catching the uncaught" << std::endl;
exit(-1);
}
////////////////////////////////////////
// The main() function.
////////////////////////////////////////
int main()
{
std::set_terminate(&terminator_2);
// The try block.
try
{
std::cout << "throwing Killer" << std::endl;
throw Killer();
}
// Catch exception handler.
catch(Bummer)
{
// Error-handling code.
std::cout << "catching Bummer" << std::endl;
}
std::cout << "done" << std::endl;
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -