why dividing by zero crash the program rather i think it should show error? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 1

why dividing by zero crash the program rather i think it should show error?

27th Jun 2016, 10:19 AM
DEATH WALKER
DEATH WALKER - avatar
2 Antworten
+ 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.
27th Jun 2016, 11:36 AM
Venkatesh(Venki)
Venkatesh(Venki) - avatar
+ 2
You could try-catch it so it doesnt crash the program.
27th Jun 2016, 10:37 AM
Garme Kain
Garme Kain - avatar