Here is my source
void dealcard(int towho, CCard* pDeck, CCard* pPlayerCard, int* pPlayertotal, int* pCputotal)
{
switch(towho)
{
case 1:
for(int i = 0; i < 10; i++)
{
if (pPlayerCard[i].suit == 0)
{
for(int j = 0; j < 52; j++)
{
if (pDeck[j].used = false)
{
pPlayerCard[i] = pDeck[j];
pDeck[j].used = true;
pPlayertotal += pPlayerCard[i].value;
return;
}
}
}
}
break;
case 2:
for(int k = 0; k < 52; k++)
{
if (pDeck[k].used = false)
{
pDeck[k].used = true;
pCputotal += pDeck[k].value;
}
}
break;
default:
cout<<"Error in Player# in Dealcard"<<endl;
exit(0);
break;
}
}
When I compile my program, this function is returning an error. It's saying ..
C:\My Documents\Black Jack\Blackjk.cpp(212) : error C2360: initialization of 'i' is skipped by 'case' label
C:\My Documents\Black Jack\Blackjk.cpp(195) : see declaration of 'i'
This makes me think that the for loop using the 'i' variable is not ending before the next case statement. But why is that? I've looked over this code for 10 minutes now and can't find a problem. Can you not use for statments inside case statemnents?
Any help is appreciated.
~~~~~~~~~~~
Chris Vogel
~~~~~~~~~~~
[edited by - Radagar on August 26, 2002 4:37:14 PM]