I have a program and my code is working fine with all the operators except I dont know how to take into account of the fact that the user could select division operator / and then select 0 and dividing by zero is impossible!
I was thinking of something like this
1 2 3 4 5 6 7 8
if ((operation == '/') && (number=0))
{
cout << "You cant divide by zero";
}
else
updatedTotal /= total + number;
cout << "Your current total is " << updatedTotal << endl;
}
but for some reasons the program would run the division anyway despite the if else statement...I think it is because I am using a do while loop in my program