Multiple if statements and conditions
I'm writing a program that involves manipulating 3 integer variables (a, b and c). At the moment, I have a few if statements set up for various situations but I'm having trouble with one. When variables are entered into the program, if a and b are equal to zero, a certain if statement should be executed, but also if only a is 0 a different statement should be used. I'm currently having a problem I assume is to do with the two different a = 0 statements. The snippet of my code current looks like:
Code:
else if(a == 0)
{
statement;
}
else if(a == 0 && b == 0)
{
statement 2;
}
but on running and having both a and b as zero, the program runs as if only a == 0 and gives an incorrect output. I've tried putting the second 'else if' first but that was unsuccessful and also by putting 'b == 0' before 'a ==0' with the same problem. What am I missing? Is there more validation I require, or a different condition?
Cheers in advance!