How can I check whether multiple variables are equal to the same value?

后端 未结 3 1910
你的背包
你的背包 2020-11-30 15:11

How do I compare multiple items? For example, I wish to check if all the variables A, B, and C are equal to the char \'X\' or all three are equal to \'O\'. (If 2 of them are

3条回答
  •  南方客
    南方客 (楼主)
    2020-11-30 15:25

    if((A == 'X' || A == 'O') && A == B && B == C)
    {
        // Do whatever
    }
    

提交回复
热议问题