C++ 错误C2059:语法错误:'}'
我正在写一个21点程序。我创建了一张包含两个字符串和一个整数的卡片“dealer”是“card”类的向量,“dtotal”和“deckplace”都是整数“显示”是打印卡片、套装和总数的功能。如果总计>16,则错误出现在else上方的行中C++ 错误C2059:语法错误:'}',c++,syntax-error,C++,Syntax Error,我正在写一个21点程序。我创建了一张包含两个字符串和一个整数的卡片“dealer”是“card”类的向量,“dtotal”和“deckplace”都是整数“显示”是打印卡片、套装和总数的功能。如果总计>16,则错误出现在else上方的行中 void dealerTurn() { if (dtotal<17) { do while (dtotal<17) { dealer.pop_back(deck[deckpla
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();
}
世上没有“边做边做”的事。它是while{uuuu条件{{uuuu语句}或do{uuu语句{uuuu}while{uuu条件}做这件事我觉得有点苛刻,但没有研究的1,因为你的C++书没有教你做X{Y}。也就是说,当你失败时,你就编好了,没有去看它。我没有从一本书中学习C++。我不认为do循环会导致这种语法。在post.int i0之前,我研究了这个语法错误的其他示例;惠勒++