在此代码的最后一行我得到错误,它无法找到符号钱包。任何帮助将不胜感激。
int money = money();
boolean again = again("Ready");
do {
int bet = bet(money);
int wallet = wallet(bet);
Deck deck = dealDeck();
int com = comDeal(deck);
int user = userDeal(deck);
int userTotal = userHit(user, deck);
int comTotal = comHit(com, deck, userTotal);
int winner = whoWon(userTotal, comTotal);
again = again("Play again");
}
while (again && wallet > 0);
答案 0 :(得分:8)
int wallet
在do-while
循环中定义。在while
的条件下使用它是不允许的,因为它超出了范围。
只需在do-while
循环之前声明此变量:
int money = money();
int wallet = 0;
boolean again = again("Ready");
do {
//rest of code here...
} while (<condition>);