cin >> subchoice;
switch(subchoice)
{
case 1:
gold = gold - 5;
cout << "Now you only have " << gold << " gold.\n";
cout << "blah blah";
health = 100;
break;
case 2:
cout << "blah blah"
<< "1 - Head Back in and Buy a Bed\n"
<< "2 - Find a Clothier Shop\n"
<< "3 - Find a Blacksmith's\n";
cin >> subsubchoice;
switch(subsubchoice)
{
case 1:
gold = gold - 5;
cout << "Now you only have " << gold << " gold.\n";
cout << "blah blah"
health = 100;
break;
case 2:
menuchoice = subsubchoice;
break;
case 3:
menuchoice = subsubchoice;
break;
}
}
break;
case 2:
}
} while (!boolchoice);
嘿,所以我在这里有这段代码。每当我运行它时,它总是会跳过子选择的 cin 输入。它应该做的是接受那个输入,要么让你进入旅馆,要么将那个选择应用于 menuchoice,然后在 do-while 循环的开始处重新启动你。我不知道为什么它会跳过输入然后关闭程序。任何帮助表示赞赏。