This code Associates each number with cards, so 1 = ace of hearts/spades/diamonds/clubs, 2 = 2 of clubs/spades..... and so on so here is the code
void DeckToCards(int Deck[]){
//Sets each element into Cards;
for(int i=0;i<52;i++)
{
switch(Deck[i]){
case 1:{ if(Deck[i]==1 && i<14)//Clubs
char Aces_C[]= " A (of clubs)";
else if(Deck[i]==1 && i>13 && i<27)//Spades
char Aces_S[]= " A (of spades) ";
else if(Deck[i] && i>26 && i<40)//Hearts
char Aces_H[]=" A (of hearts) ";
else if(i>=40)//Diamonds
char Aces_D[]=" A (of diamonds) ";
}
case 2:{ if(Deck[i]==2 && i<14) // 2 of Clubs
char 2_C[] = " 2 (of clubs";
else if(Deck[i]==2 && i>13 && i<27)// 2 of Spades
char 2_S[]= " 2 ( of spades)";
else if(Deck[i]==2 && i>26 && i<40)//Hearts
char 2_H[]= " 2 (of hearts)";
else if(i>=40)//Diamonds
char 2_D[]=" 2 (of diamonds)
}
case 3:
}
}
Is there any other smarter way of going about this. This code is part of a blackjack game by the way.