feat: 统一 cpp 文件编码格式为 utf-8

This commit is contained in:
tracyxiong1
2023-01-02 20:39:00 +08:00
parent ade7173887
commit 368eda305f
63 changed files with 327 additions and 327 deletions

View File

@@ -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...";

View File

@@ -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;}
}

View File

@@ -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(){

View File

@@ -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;

View File

@@ -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;}