尽管不符合条件但仍要输入陈述 [英] Entering If Statement Despite Not Meeting Condition
本文介绍了尽管不符合条件但仍要输入陈述的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是一个特定的问题,但我似乎无法弄清楚出了什么问题。
This is a specific problem, but I can't seem to figure out what is wrong.
else if (X == 2)
//move left
{
if (Level[X-1][Y] == 0);
{
cout << Level[X-1][Y] << "\n";
cout << "\n MOVING LEFT from RIGHT\n"; //PROBLEM IS HERE
Level[X][Y] = 1; // block it
X = X - 1;
moved = 1;
}
}
我正在做的是检查是否等级[ X-1] [Y]是1,表示一列,所以我无法移动我的播放器。但是由于某种原因,尽管它是1而不是0(如输出所示),仍然可以访问IF语句。任何帮助将不胜感激。
What I am doing is I am checking if Level[X-1][Y] is 1, indicating a column, so I can not move my player there. However for some reason, despite it being 1 and not 0 (as indicated by the output), the IF statement is still accessed. Any help will be appreciated.
推荐答案
分号!!!
if (Level[X-1][Y] == 0);
这篇关于尽管不符合条件但仍要输入陈述的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文