I'm writing a program for blackjack and am using an array with and index of 53 with the first 52 spaces for the cards and the 53rd is for keeping track of how many cards are left in the "deck". There are several function prototypes and when I compile I only have a problem with the switch statement for "scoring the card"
int Score_Card(int card)
{
int rank=card%13 + 1;
switch(rank)
{
case 1:
return rank;
break;
case 2:
return rank;
break;
case 3:
return rank;
break;
case 4:
return rank;
break;
case 5:
return rank;
break;
case 6:
return rank;
break;
case 7:
return rank;
break;
case 8:
return rank;
break;
case 9:
return rank;
break;
case 10:
return rank;
break;
case 11:
return 10;
break;
case 12:
return 10;
break;
case 13:
return 10;
break;
}
}
I was under the impression that you could use this method of obtaining a return value through switch statements. However, the compiler says:In function `Score_Card':
[Warning] control reaches end of non-void function
[Build Error] [blackjacknov12.o] Error 1
?????;)
is what this function says to do not allowed? Or am I missing some silly small thing??


Sign In
Create Account

Back to top









