c++程序在中间暂停,控制台处于进入模式



我正在编写一个程序,允许用户制作一个3对3幻想生物的锦标赛。比赛的实际比赛部分很好,但在我最后一句台词说谁赢得了最后一场比赛之后,当我试图输出积分榜时,出现了一个空白,就像有cin出现一样,但如果进入,什么都不会发生。我确信有更巧妙的方法来绘制我的地图,但我不明白为什么即使是没有变量的cout的顶线也不会出现。这只是战斗结束后代码的一部分。点和立都是int,int映射。

for (int i=1; i<7;i++)
{
    for (int j=1; j<7;i++)
    {
        if ((points[i]==points[j])&&(i!=j))
        {
            int tie=rand()%2;
            if (tie==0)
            {
                points[i]=points[i]+1;
            }
            else
            {
                points[j]=points[j]+1;
            }
        }
    }
}
for (int i=1;i<7;i++)
{
    standing[(points[i])]=i;
}
map <int,int>::iterator k;
k=standing.begin();
cout << "These are the final standings. n";
cout << "Please note fighters 1-3 are player 1 and n";
cout << "4-6 are from player 2. n";
cout << "In first place is fighter #" << k->second;
cout << " with " << k->first << "points n";
k++;
cout << "In second place is fighter #" << k->second;
cout << " with " << k->first << "points n";
k++;
cout << "In third place is fighter #" << k->second;
cout << " with " << k->first << "points n";
return 0;

for (int j=1; j<7;i++)是一个无限循环——你可能是指j++。因此,cout行永远不会被执行。

最新更新