+ 1
why dividing by zero crash the program rather i think it should show error?
2 Respostas
+ 4
Assume If compiler is designing to show an error when divide by zero condition occur, then where exactly it will show this error. Because not always you will use cout, sometimes you have to use files or some streaming object.
So to avoid such conditions, compiler designed to throw that error (exception). It's developer duty to catch all possible exceptions. If developer failed to catch the exceptions then application crash......
Hope you understand this well.
+ 2
You could try-catch it so it doesnt crash the program.