I\'m using c++ in visual studio express to generate random expression trees for use in a genetic algorithm type of program.
Because they are random, the trees often
Never tried it, but assuming divide by zero throws an exception, you could just wrap the code in a try/catch like this:
try { // potential divide by zero... } catch(...) { // ... catches ALL exceptions }