0

Dividing by 0

In C++ operator lesson, it said, "Dividing by 0 will crash your program." Has it happened to anyone? Would the program start-up again?

30th Nov 2017, 12:49 AM
Dipti Muni
Dipti Muni - avatar
3 odpowiedzi
+ 8
I knew a guy that it happened to, we never heard from him again. No one starts up again after you divide by zero.
30th Nov 2017, 12:50 AM
AgentSmith
+ 3
https://en.m.wikipedia.org/wiki/Division_by_zero the result is "indeterminable", in theory you would get infinity, but if a/0=b, a=b*0 but then a=0. https://code.sololearn.com/cmhm6kN4vc7A/?ref=app
30th Nov 2017, 11:56 AM
Illusive Man
Illusive Man - avatar
0
Use a catch keyword; try and catch an exception. That way, the program will keep running.
30th Nov 2017, 8:39 AM
Rizan
Rizan - avatar