0
How can I treat different exceptions with different outcomes in C++, should I add some kind of a switch() or if() conditions ?
3 Antworten
+ 1
Use the else if statement. For example.
int x=0;
for(x = 0; x <= 50; x++){
if(x = 10){
cout << "x is now 10 << endl;
} else if(x = 20){
cout << "x is now 10 times 2"<< endl;
} else{
cout << x;
}
}
}
0
thank you for your response @Eddy, but that's not actually what I'm looking for, I'm asking about exceptions, for instance, in Java we use try and catch, and we use multiple catch blocks to treat different types of exceptions, so I'm looking for the equivalent in C++.
0
Ah right. Can't help you with that one sorry. I only did C++