c14-2-2.cpp

来自「谭浩强C++编程教材第二版 教材所有例题的程序」· C++ 代码 · 共 39 行

CPP
39
字号
#include <iostream>
using namespace std;
int main()
{void f1();
 try
  {f1();}
 catch(double)
  {cout<<"OK0!"<<endl;}
 cout<<"end0"<<endl;
 return 0;
}

void f1()
{void f2();
 try
  {f2();}
 catch(char)
  {cout<<"OK1!";}
 cout<<"end1"<<endl;
}

void f2()
{void f3();
 try
 {f3();}
 catch(int)
 {cout<<"Ok2!"<<endl;}
 cout<<"end2"<<endl;
}
void f3()
{double a=0;
 try
  {throw a;}
 catch(double)
  {cout<<"OK3!"<<endl;}
 cout<<"end3"<<endl;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?