If the syntax is wrong the compiler will produce an error, so that way you will know anyway.
If it is compiling but not working as you expect then it’s going to be a logic error, in which case you can use a debugger to work out why.
It doesn’t seem to be a syntax error, so I would suggest debugging it.
solved Is there anything wrong with this IF statement? (C++) [closed]