2 things.
1) use == instead of =
if (result == 0)
since you use a single =, it is assigning result to be 0. since 0 is false, the if statement doesn't execute. since 0 is not greater or less than 0, the other ifs aren't executed either.
2) minor point, but you should indent the body of the if condition, and also use braces around the body. it's not needed, but it helps you pick up bugs much faster.
instead of:
Code
if (result == 0)
cout << "result is zero" << end1;
do:
Code
if (result == 0){
cout << "result is zero" << end1;
}
This post was edited by carteblanche on Sep 9 2015 05:18pm