C++异常
除数为0,内存分配失败,数组越界等
try throw catch
throw excetion类
异常机制
3步 try throw catch
int main(){
int score=0;
while(cin>>score){
try{
if(score>100||score<0){
throw score;
}catch(int score){
cerr<<"出问题了";
continue;
}
}
}
}
int main(){
std::string str = "123456";
try{
char</