Originally Posted by
m.mixon
pl1attack = 2
pl2move = 2
those two variables should produce a true
and
pl2attack = 2
pl1move = 1
those to variable should produce a false, which combined with a
"!=", should produce a true, right?
When a certain part of your program gives you a different answer than what you expect, there are two possibilities:
1. You aren't feeding the values that you thought.
2. The expression evaluates differently than you thought.
Assuming that your analysis is correct, what could be the problem?
You could try to see what the program is working on:
Code:
.
.
.
printf("pl1attack = %d, pl1move = %d, pl2attack = %d, pl2move = %d\n",
pl1attack, pl1move, pl2attack, pl2move);
if (pl1attack == pl2move && pl2attack != pl1move)
{
printf("You hit your opponent for 1 hp\n");
}
.
.
.
If you are feeding these values to the expression and it's evaluating differently, then you need to check again. If you aren't feeding the values that you thought, then find out how they got that way.
D