错误C2059:语法错误:'}'

时间:2013-01-15 01:34:10

标签: c++ syntax-error

我正在写一个二十一点程序。我创建了包含两个字符串和一个整数的类卡。 '经销商'是类'卡'的向量,'dtotal'和'deckplace'都是整数。 'display()'是一个打印卡片,套装和总计的功能。错误发生在“else if(total> 16)”上面的行中。

void dealerTurn()
{
    if (dtotal<17)
    {
        do while (dtotal<17)
        {
            dealer.pop_back(deck[deckplace]);
            deckplace = deckplace+1;

            for (y=0;y<dealer.size();y++)
            {
                if (dealer[y].name=="A" && dtotal>21)
                {
                    dealer[y].value = 1;
                    dtotal = 0;
                    for (z=0;z<dealer.size();z++)
                        dtotal = dtotal + dealer[z].value;
                }
            }

            display();

            if (dtotal>21)
            {
                cout << endl << "-----DEALER BUSTED!-----" << endl << endl;
                dtotal = 0;
            }
        }
    }
    else if (total>16)
    {
        display();
    }
    result();
}

1 个答案:

答案 0 :(得分:12)

没有do while之类的东西。它可以是while (__condition__) { __statements__ }do { __statements__ } while (__condition__);

相关问题