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?
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.
+ 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
0
Use a catch keyword; try and catch an exception. That way, the program will keep running.