janedaring

关注

try语句...

janedaring

关注

阅读 58

2022-03-18


#include<stdio.h>

#include<iostream>

using namespace std;

int main( )

{

try

{

throw "嗨 ! 我引发了一个异常!";

cout<<"正常执行 1"<<endl;

}

catch(const char* s)

{

cout<<s<<endl;

cout<<"异常类型 : int"<<endl;

}

catch(int i)

{

cout<<i<<endl;

cout<<"异常类型: int "<<endl;

}

cout<<"正常执行2"<<endl;

return 0;

}


编程是一种快乐,享受代码带给我的乐趣!!!


相关推荐

一天清晨

JavaScript中,try...catch 语句

一天清晨 11 0 0

龙驹书房

try - catch 语句真的会影响性能吗?

龙驹书房 138 0 0

小禹说财

Python异常处理语句try...except...else...finally...

小禹说财 96 0 0

猎书客er

Java:try catch finally语句复习(作用、执行顺序、return问题)

猎书客er 61 0 0

忆北文学摄影爱好员

在 JDK 9 中更简洁使用 try-with-resources 语句

忆北文学摄影爱好员 51 0 0

文风起武

别被骗了,try-catch语句真的会影响性能吗?

文风起武 95 0 0

whiteMu

Java中AutoCloseable接口与try-with-resources语句自动释放资源

whiteMu 45 0 0

天使魔鬼

C++ Primer第五版 try语句块和异常处理

天使魔鬼 62 0 0

艾米吖

【java9】java9新特性之try-with-resources语句改进

艾米吖 35 0 0

一脸伟人痣

ernic bot try

一脸伟人痣 60 0 0

精彩评论(0)

0 0 举报