Compile error

 

It can't report error while use "=" instead "==" in program code. So, program run incorrect.

 
I think it is correct for C++
 

There is no error in using "=" in comparison, but (a = b) will always return true. Just be more attentive when you write your code.
 

thanks