使用try catch抛出和捕获异常
2016-09-25 18:09
162 查看
#include <iostream>
#include <exception>
using namespace std;
void main()
{
string error;
int a,b;
cin>>a>>b;
try
{
if(a>b)
throw 100;
}
catch(int)
{
cout<<"error1"<<endl;
}
cin.get();
}
#include <exception>
using namespace std;
void main()
{
string error;
int a,b;
cin>>a>>b;
try
{
if(a>b)
throw 100;
}
catch(int)
{
cout<<"error1"<<endl;
}
cin.get();
}
相关文章推荐
- 过滤器、监听器、拦截器
- C语言学习笔记 lesson12 循环
- struts2的文件上传操作源码解析
- 数据结构实验之链表七:单链表中重复元素的删除
- 1103. Integer Factorization
- linux上的文件管理类命令
- @JsonFormat使用
- [专题2016-09-07]转账交易测试点
- python标准模块学习4_______platform模块
- 20145240 《信息安全系统设计基础》第二周学习总结
- 单调队列优化DP,多重背包
- LeetCode No.85 Maximal Rectangle
- HDU 1171 Big Event in HDU 多重背包 .
- EZOI [NOIP模拟赛][线段树]
- Infer 在 Mac 上的安装和环境配置
- 自然原始分工
- 几句话就能让你理解:this、闭包、原型链
- 若处理器是Big_endian的,则返回0;若是Little_endian的,则返回1
- 函数指针语法梳理
- hibernate工作原理