one way of doing is to have a file with defined errors, and then just trowing them, and catch them as ints
something like this:
Code:
#define DivideByZero 23123
...
try
{
...
throw DivideByZero;
}
catch(int e)
{
if(e == DivideByZero)
do w/e
}
or you could make an exception class and derive all kinds of classes from it. and throw the classes and catch them as exceptions like:
Code:
class Exception
{
string s; // to store the error message
//other vars/functions if you want
};
class DevideByZero : public Exception
{
//in constructor set s to someting like "Cannot Devide by Zero"
};
...
throw DevideByZero;
...
catch(Exception e)
Or something similar im not on a computer with a compiler at the moment.