feat: 统一 cpp 文件编码格式为 utf-8
This commit is contained in:
@@ -8,7 +8,7 @@ int main(){
|
||||
throw 10;
|
||||
cout<<"3--After throw ...."<<endl;
|
||||
}
|
||||
catch(double i) { //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>10.1<EFBFBD><EFBFBD>ͬ
|
||||
catch(double i) { //仅此与例10.1不同
|
||||
cout<<"4--In catch block1 .. an int type is.."<<i<<endl;
|
||||
}
|
||||
cout<<"5--After Catch...";
|
||||
|
@@ -3,8 +3,8 @@ using namespace std;
|
||||
void temperature(int t)
|
||||
{
|
||||
|
||||
if(t==100) throw "<EFBFBD>е㣡";
|
||||
else if(t==0) throw "<EFBFBD><EFBFBD><EFBFBD>㣡";
|
||||
if(t==100) throw "沸点!";
|
||||
else if(t==0) throw "冰点!";
|
||||
else{cout<<"temperatore="<<t<<endl;}
|
||||
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//Eg10-7.cpp
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
//<EFBFBD>ڲ<EFBFBD><EFBFBD>ٴ<EFBFBD>throw<EFBFBD>쳣<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD>throw()
|
||||
//内部再次throw异常的时候,函数不要带throw()
|
||||
void Errhandler(int n)
|
||||
{
|
||||
try{
|
||||
@@ -10,7 +10,7 @@ void Errhandler(int n)
|
||||
}
|
||||
catch(int n){
|
||||
cout<<"catch an int exception inside..."<<n<<endl;
|
||||
throw n; //<EFBFBD>ٴ<EFBFBD><EFBFBD>׳<EFBFBD><EFBFBD><EFBFBD>catch<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>쳣
|
||||
throw n; //再次抛出本catch捕获的异常
|
||||
}
|
||||
}
|
||||
int main(){
|
||||
|
@@ -2,8 +2,8 @@
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
const int MAX=3;
|
||||
class Full{}; //L1 <EFBFBD><EFBFBD>ջ<EFBFBD><EFBFBD>ʱ<EFBFBD>׳<EFBFBD><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><EFBFBD>
|
||||
class Empty{}; //L2 <EFBFBD><EFBFBD>ջ<EFBFBD><EFBFBD>ʱ<EFBFBD>׳<EFBFBD><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><EFBFBD>
|
||||
class Full{}; //L1 堆栈满时抛出的异常类
|
||||
class Empty{}; //L2 堆栈空时抛出的异常类
|
||||
class Stack{
|
||||
private:
|
||||
int s[MAX];
|
||||
@@ -26,7 +26,7 @@ int main(){
|
||||
Stack s;
|
||||
try{
|
||||
s.push(10); s.push(20); s.push(30);
|
||||
//s.push(40); //L5 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ջ<EFBFBD><EFBFBD><EFBFBD>쳣
|
||||
//s.push(40); //L5 将产生栈满异常
|
||||
cout<<"stack(0)= "<<s.pop()<<endl;
|
||||
cout<<"stack(1)= "<<s.pop()<<endl;
|
||||
cout<<"stack(2)= "<<s.pop()<<endl;
|
||||
|
@@ -19,7 +19,7 @@ class DiskNotFound:public FileSysException{
|
||||
};
|
||||
int main(){
|
||||
try{
|
||||
// ..... //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// ..... //程序代码
|
||||
throw FileSysException();
|
||||
}
|
||||
catch(DiskNotFound p){cout<<p.Where()<<endl;}
|
||||
@@ -27,7 +27,7 @@ int main(){
|
||||
catch(FileSysException p){cout<<p.Where()<<endl;}
|
||||
catch(BasicException p){cout<<p.Where()<<endl;}
|
||||
try{
|
||||
// ..... //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// ..... //程序代码
|
||||
throw DiskNotFound();
|
||||
}
|
||||
catch(BasicException p){cout<<p.Where()<<endl;}
|
||||
|
Reference in New Issue
Block a user