Thats because divide by zero does not throw and exception and you need to test that and throw the exception yourself. Something like
Code: CPP
if (b == 0)
    throw 1;
else
    a=a/b;