C++ exception

来源:互联网 发布:淘宝买家号注册 编辑:程序博客网 时间:2024/06/05 20:37

throw , try, catch 使用

int x1 = 0, x2 = 1;try{if(x1!=x2){throw runtime_error("Number must be equal !");}}catch(runtime_error& ex){cout << ex.what() << endl;}


0 0