CPlusPlusThings/practical_exercises/10_day_practice/day9/异常例子/2.cpp
2023-01-02 20:39:00 +08:00

18 lines
441 B
C++

//Eg10-2.cpp
#include<iostream>
using namespace std;
int main(){
cout<<"1--befroe try block..."<<endl;
try{
cout<<"2--Inside try block..."<<endl;
throw 10;
cout<<"3--After throw ...."<<endl;
}
catch(double i) { //仅此与例10.1不同
cout<<"4--In catch block1 .. an int type is.."<<i<<endl;
}
cout<<"5--After Catch...";
system("pause");
return 0;
}