C++之try和catch入门
来源:互联网 发布:手机淘宝销量排名 编辑:程序博客网 时间:2024/05/18 00:34
//流程://try---->throw -----> catch()//打印2222222!//流程Div->thow b->catch(int)#include <iostream> using namespace std; int Div(int a, int b) { if(b == 0) { throw b; } cout<<"OK"<<endl; return a/b; } void main() { int a,b; a = 1; b = 0; try { Div(a,b); } catch(int) { cout<<"2222222!"<<endl; } catch(...) { cout<<"11111111110!"<<endl; } } //打印1111111111!//流程Div->catch(...) #include <iostream> using namespace std; int Div(int a, int b) { cout<<"OK"<<endl; return a/b; } void main() { int a,b; a = 1;b = 0; try { Div(a,b); } catch(...) { cout<<"2222222!"<<endl; } catch(...) { cout<<"1111111111!"<<endl; } }
0 0
- C++之try和catch入门
- smali入门之try..catch
- JavaScript知识点之try()、catch()和throw()
- 【c#】try...catch...finally
- C++之try...catch...
- C#之try-catch
- JavaScript入门之错误—Throw.Try.Catch
- C++之try catch 异常处理入门实例
- 使用try和catch
- try catch和封装
- try 和 catch
- try catch 和 throwde
- Try、catch和finally
- try catch 和 throw
- java异常处理之throw, throws,try和catch
- java异常处理之throw, throws,try和catch
- java异常处理之throw, throws,try和catch
- java异常处理之throw, throws,try和catch
- Android Studio 插件无缘无故就消失了
- 紫书章六例题一(双端口队列)
- 第四次作业
- 基于Socket编程的网络聊天室
- Jmeter基础-参数化
- C++之try和catch入门
- zoj2833
- Linux 操作系统错误代码解释
- 第二章 JAVA中的变量和常量学习
- 九度OJ题目1041:Simple Sorting解题报告
- python发邮件
- VS宝典之生成的各个文件类型
- hdu 3652 数位dp
- effective javascript(一)——认识javascript浮点数