使用try catch抛出和捕获异常

#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(); }
相关文章
相关标签/搜索