使用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(); }
相關文章
相關標籤/搜索