try catch 使用

来源:互联网 发布:linux强行关闭程序 编辑:程序博客网 时间:2024/06/05 04:00
#include<iostream>using namespace std;int min(int a,int b){    if(a>b)    throw a;    return a;}int main(){    int a,b,c;    try    {        c=min(3,2);        cout<<c<<endl;    }    catch(int)    {        cout<<"error 1"<<endl;    }    return 0; } 
0 0
原创粉丝点击