0

How can I treat different exceptions with different outcomes in C++, should I add some kind of a switch() or if() conditions ?

9th Dec 2016, 4:06 PM
A B
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; } } }
9th Dec 2016, 5:02 PM
Eddy
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++.
9th Dec 2016, 9:51 PM
A B
0
Ah right. Can't help you with that one sorry. I only did C++
9th Dec 2016, 10:11 PM
Eddy