order decks cards

i dont know was wrong with print function i need to order the cards eg, two to Ace of Spades, two to Ace of Hearts, two to Ace of Clubs, and two to Ace of Diamonds).


void printDeck(Card deck[], int num)
{
for (int x=0; x<num; x++){
cout << deck[x].card_suit << " of " <<deck[x].card_rank << endl;
}

}

void createDeck( Card deck[], int num)
{
int y = 0, z = 2;
for( int x=0; x<num ; x++){
if(z==15){
y++;
z=2;
}
deck[x].card_suit = (Suit)y;
deck[x].card_rank = (Rank)z;
z++;
}
There were some extended discussions about Card classes (including printing, sorting, etc) on this forum recently, instigated by the same user AFAICR. Here are a couple of links and perhaps there are few more:
http://www.cplusplus.com/forum/beginner/211226/
http://www.cplusplus.com/forum/beginner/211044/#msg989293
Topic archived. No new replies allowed.