If statements not working?
Solution 1:
You're confusing the assignment operator =
with the equals operator ==
. Write this instead:
if (battlechoice == 4)
And so on.
Some C programmers use "Yoda conditionals" to avoid accidentally using assignment in these cases:
if (4 == battlechoice)
For example this won't compile, catching the mistake:
if (4 = battlechoice)
Solution 2:
you are writing if(battlechoice=4) correct it with if(battlechoice==4)
because '=' and '==' operators both are different
'=' is Assignment Operator and '==' is comparison operator
see the link for operators in C http://www.tutorialspoint.com/cplusplus/cpp_operators.htm