//Check if one number is 0
cout << "There is no unknown variable.";
//Output answer, if one variable is 0
cout << "Your unknown variable is " << answer << "!";
That is some code to my proportion calculator. Normally, it would output the answer. But I said that if all the numbers are less than 0(I use that as the unknown variable) that it will output there is no variable.
It does say "there is no variable" if there is none. However it will output the answer(0).
There is no unknown variable.Your unknown variable is 0!
If (numerator1 == 0) && numerator2 == 0 && denominator2 == 0) cout <<"There is no unknown variable";
or (more logically)
if (numerator1 != 0) cout<<"Your unknown variable is "<<numerator1;
else if (numerator2 != 0) cout<<"Your unknown variable is "<<numerator2;
else if (denominator != 0) cout<<"Your unknown variable is "<<denominator2;
else cout<<"There is no variable.";
Assuming you wanted it to check if denominator 2 is equal to zero, you didn't specify a statement or condition in the if statement.