我想實現一些圖形,但我有麻煩調用函數int rollDice()顯示在最底部,我不知道如何解決這個問題?任何想法...我得到一個錯誤錯誤C3861:'rollDice':標識符未找到。錯誤C3861:'rollDice':標識符未找到
int rollDice();
void CMFCApplication11Dlg::OnBnClickedButton1()
{
enum Status { CONTINUE, WON, LOST };
int myPoint;
Status gameStatus;
srand((unsigned)time(NULL));
int sumOfDice = rollDice();
switch (sumOfDice)
{
case 7:
case 11:
gameStatus = WON;
break;
case 2:
case 3:
case 12:
gameStatus = LOST;
break;
default:
gameStatus = CONTINUE;
myPoint = sumOfDice;
break;
}
while (gameStatus == CONTINUE)
{
rollCounter++;
sumOfDice = rollDice();
if (sumOfDice == myPoint)
gameStatus = WON;
else
if (sumOfDice == 7)
gameStatus = LOST;
}
if (gameStatus == WON)
{
}
else
{
}
}
int rollDice()
{
int die1 = 1 + rand() % 6;
int die2 = 1 + rand() % 6;
int sum = die1 + die2;
return sum;
}
更新功能rollDice
int rollDice();
的
採取相關鏈接到正確的,http://stackoverflow.com/questions/12723107/error-c3861-initnode-identifier-not-found?rq=1 – chris 2013-04-30 01:32:29
爲什麼你編輯你的問題,包括答案?這個問題現在沒有意義。 – caps 2016-08-11 19:57:50