hmm... hope this will help:
you must to know that it's like a script / scenario of (how) your program will react, e.g:
1 2 3 4 5 6 7 8 9 10
|
else if (function == '%'){ //Line 81
cout << "The answer to " << m << " " << function << " " << n << " "
<< "is: "<< m % n << endl;
if (n == 0)
cout << "Cannot modulus by 0. Please re-enter." << endl;
}
|
the computer will read the first instruction
when / if it met the condition. like you reading a book or a scenario, from up-down, left-right, right? so (maybe) this is what the computer think:
computer: "the function is '%', what am i gonna do? oh tell the user "the answer to (variable_m) % (variable_n) is (variable_m % variable_n)"
the computer does it because it was the
first instruction from the program (code) when the computer met that condition. while the computer calculate the division it crash because integer cannot divided by 0. so, if you met that condition (division by 0) the
if
line will never be exceuted.
btw, you know the use of curly braces, right?