I am trying to find a way to see if 5 or so variables all contain the same number in an if statement. Something to the effect of this.
Code:if(getrow21() == getrow22() == getrow23() == getrow24() == getrow25())
This is a discussion on Need help checking variables within the C++ Programming forums, part of the General Programming Boards category; I am trying to find a way to see if 5 or so variables all contain the same number in ...
I am trying to find a way to see if 5 or so variables all contain the same number in an if statement. Something to the effect of this.
Code:if(getrow21() == getrow22() == getrow23() == getrow24() == getrow25())
Nevermind figured it out.
Can you please post how you did it? May help others with same question, or who just wan't to learn.
the most obvious (but most tedious) way:
Code:if ( var1 == var2 ) && ( var1 == var3 ) && ( var1 == var4 ) && ( var1 == var5 ) { /*Do Stuff */ }
That won't even compile.the most obvious (but most tedious) way
Code:if ( var1 == var2 ) && ( var1 == var3 ) && ( var1 == var4 ) && ( var1 == var5 ) { /*Do Stuff */ }
He forgot the outer parenthesisOriginally Posted by 7stud
I pretty much did what he said to do. Might end up changing how it keeps values later on and work on something better, but that works for now.