English 中文(简体)
c++ 存在奇怪的问题
原标题:c++ having strange problem

我的职能是创造和在病媒中添加一些内容。

    if(Enemy2.dEnemy==true)
    {
        pt.y=4;
        pt.x=90;
        pt2.y=4;
        pt2.x=125;
        for(int i=0; i<6; i++)
        {
            Enemy2.vS1Enemy.push_back(pt);
            Enemy2.vS2Enemy.push_back(pt2);
            y-=70;
            pt.y=y;
            pt2.y=y;
        }
        Enemy2.dEnemy=false;
        Enemy3.cEnemy=0;
    }

它应在两个病媒中插入6个数字,唯一的问题是:doesn t——实际上插入more

我不认为,除非<条码>Enemy2.dEnemy = 真正的,否则该信将有效,而且它从未赢得过。

The snippet的首次运行, 然后是 Enemy2.dEnemy 定在false上,斜线再次运行。

页: 1 除窗户外,在任何地方均设有。

如果在刀子中添加一个切点,则该方案将进行罚款——它将在两个病媒中插入6个单体。

Any ideas what s wrong here?


ok so i did some debugging.
i found that Enemy2.dEnemy=false; is being skipped for some reason.
i tried to do this to see if it was.
 if(Enemy2.dEnemy)
    {
        pt.y=4;
        pt.x=90;
        pt2.y=4;
        pt2.x=125;
        for(int i=0; i<6; i++)
        {
            Enemy2.vS1Enemy.push_back(pt);
            Enemy2.vS2Enemy.push_back(pt2);
            y-=70;
            pt.y=y;
            pt2.y=y;
        }
        TCHAR s[244];
        Enemy2.dEnemy=false;
        if(Enemy2.dEnemy)
        {
          MessageBox(hWnd, _T("0"), _T(""), MB_OK);
        }
        else
        {
            MessageBox(hWnd, _T("1"), _T(""), MB_OK);
        }
        Enemy3.cEnemy=0;
    }

well the message box popped saying 1 and my code worked fine. it seems that Enemy2.dEnemy=false; doesn t have time to run ;/
blahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblah! ok i found where is the real problem which was causing to insert more than 6 numbers.. it was where i was asigning Enemy2.dEnemy=true;

if(Enemy2.e1)
{
Enemy2.now=time(NULL);
Enemy2.tEnemy=Enemy2.now+4;
Enemy2.e1=false;
}
if(Enemy2.tEnemy==time(NULL))
{
check=1;
Enemy2.aEnemy=0;
Enemy2.dEnemy=true;
}

问题似乎是,如果时间不止一次,那就好了!

最佳回答

首先:删除这一可操作的<代码>if(Enemy2.dEnemy=真实)

if (Enemy2.dEnemy)

(我也更喜欢把我的船只命名为可读的刑期,如<代码>。) Enemy2.isABerserker or Enemy3.hasHadLeftLegCutOffreThreeInches Below TheKnee but that s only personal favor.

除此以外,我所能建议的唯一事情是,一个可怕的问题。 这部法典本身没有任何错误,但有一个窗口,即两条线可以进入<条码>,条件是,而且两者都开始将价值观推向你的病媒。

换言之,如果第1版在接通<条码>时正在推进,则第2版还将开始推导数值,因为第1版尚未将<条码>dEnemy 至<条码>。 不要认为你只能把任务移至<条码>>,如果是<>条/条码>栏目——这将减少,但not去除窗户。

我的建议是,在病媒有6个以上条目的情况下,印刷这些病媒的内容,并可能对所发生事件(如果你愿意的话,将产生结果)。


更新第二版<编码>if 以下为两次:

if(Enemy2.e1)
{
Enemy2.now=time(NULL);
Enemy2.tEnemy=Enemy2.now+4;
Enemy2.e1=false;
}
if(Enemy2.tEnemy==time(NULL))
{
check=1;
Enemy2.aEnemy=0;
Enemy2.dEnemy=true;
}

如果该守则在第二版(且不超出可能的范围)中执行过两次,则第二版<条码>。

这是因为time(NUL)给你自古时代以来的第二位数,直到第二位数结束为止,你很可能执行<>code>if<>m>thousands of倍数(或更多)。

问题回答

如果在你发出断点或诊断性产出信息时,这个问题就消失了,那么,这个问题就是一个很强的cl,其原因通常是一些事情,如忽略一个未开端的点子或无情地使用星座。

问题的原因很可能与你回顾的法典无关。 它造成其他地方的混乱,而只是在这里出现。 它像有人被倒塌的砖子打的:明显的症状是,在双向上没有意识的男子,但真正的问题与男子或旁边的人毫无关系,它引出了几个故事。

如果你想找到这一错误的原因,在问题重新出现之前取消你的诊断,然后开始删除 否则<>。 废除所有其他法典。 每当错误停止时,该错误才重新开始;如果你看不出错误的原因,就开始在其他地方。 最终,这些 b子不会藏匿。





相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签