I am modifying a deal function to deal the cards to 4 players and then print them out. It is all written but all 4 players get the same cards...Any help would be apprecieated
Code:
void dealdeck(Card *deckptr , Card handsDealt [4][5])
{
int i;
for(i=0;i<5;i++)
{
handsDealt[1][i].faceValue = faces[deckptr[i].faceValue];
handsDealt[1][i].suitValue = deckptr[i].suitValue;
handsDealt[2][i].faceValue = faces[deckptr[i].faceValue];
handsDealt[2][i].suitValue = deckptr[i].suitValue;
handsDealt[3][i].faceValue = faces[deckptr[i].faceValue];
handsDealt[3][i].suitValue = deckptr[i].suitValue;
handsDealt[4][i].faceValue = faces[deckptr[i].faceValue];
handsDealt[4][i].suitValue = deckptr[i].suitValue;
}
printf("\nPlayer One's Cards...\n");
for(i=0;i<5;i++)
{
printf("%c of %c, ",handsDealt[1][i].faceValue, handsDealt[1][i].suitValue);
}
printf("\nPlayer Two's Cards...\n");
for(i=0;i<5;i++)
{
printf("%c of %c, ",handsDealt[2][i].faceValue, handsDealt[2][i].suitValue);
}
printf("\nPlayer Three's Cards...\n");
for(i=0;i<5;i++)
{
printf("%c of %c, ",handsDealt[3][i].faceValue, handsDealt[3][i].suitValue);
}
printf("\nPlayer Four's Cards...\n");
for(i=0;i<5;i++)
{
printf("%c of %c, ",handsDealt[4][i].faceValue, handsDealt[4][i].suitValue);
}printf("\n\n\n\n");
}
Output:
Code:
Player One's Cards...
Q of ♥, 5 of ♥, 4 of ♥, A of ♣, 6 of ♥,
Player Two's Cards...
Q of ♥, 5 of ♥, 4 of ♥, A of ♣, 6 of ♥,
Player Three's Cards...
Q of ♥, 5 of ♥, 4 of ♥, A of ♣, 6 of ♥,
Player Four's Cards...
Q of ♥, 5 of ♥, 4 of ♥, A of ♣, 6 of ♥,