I didnt see what mistake is here :/

Feb 1, 2017 at 7:19pm
"C:\Users\CosminPerRam\OneDrive\CosminPerRam Stuff\Projects\C++\Code Blocks 16.01\Mine\MultiIfs\main.cpp|46|warning: suggest parentheses around comparison in operand of '==' [-Wparentheses]|
1
2
3
4
if(pc0 == pc1 == pc2 == 'X' || pc3 == pc4 == pc5 == 'X' || pc6 == pc7 == pc8 == 'X' || pc0 == pc3 == pc6 == 'X' || pc1 == pc4 == pc7 == 'X' || pc2 == pc5 == pc8 == 'X' || pc0 == pc4 == pc8 == 'X' || pc2 == pc4 == pc6 == 'X')
{
 // code
}

I dont understand why, please quick help me :)
Feb 1, 2017 at 7:45pm
I guess you may heave meant that all of pc0, pc1, pc2 are equal to 'X'.
1
2
    if (pc0 == pc1 == pc2 == 'X' 
    etc.

could be written as something like this:
1
2
    if ((pc0 == 'X' && pc1 == 'X' && pc2 == 'X')
    etc. 

Feb 2, 2017 at 10:12am
yes, it worked, thanks!
Topic archived. No new replies allowed.