mercredi 29 juillet 2015

A multiple equality/inequalityconditions checking in if statements

I am a newbie to programming in C++ and I have a question regarding if conditions. We are currently learning C++ at school(Using TC, i know it's an old compiler,but yeah). I am currently making a tic-tac-toe program, an undefeatable one. Now, this is my problem.

I want to check the equality of 3 variables, and run the if body only if the 3 variables are not equal to another variable. Why is this set of code not working?

if(a==b==c!=d)
{
}

Adding parentheses doesn't help, I'm probably doing it wrong.(Please excuse my ignorance)

if((a==b==c)!=d)
{
}

Thanks in advance! -CaptainAwesome

Aucun commentaire:

Enregistrer un commentaire