标签:
#include<iostream> #include<stdexcept> #include<exception> using namespace std; int main() { int a,b; a=-3; b=2; try { if((a+b)<0) throw runtime_error("have something wrong!!!"); cout<<a+b<<endl; } catch(runtime_error err ) { cout<< err.what(); cout<<a<<‘ ‘<<b<<endl; } system("pause"); return 1; }
标签:
原文地址:http://www.cnblogs.com/yanliang12138/p/4215278.html