Question: Modify your Exercise #10 code so that the printing of the suit and the printing of the face of a card are each handled by
Modify your Exercise #10 code so that the printing of the suit and the printing of the face of a card are each handled by a function. Write the functions so that everything for printing is contained inside the function.
int main()
{
int i;
char face[14][6] = { "2", "3", "4", "5", "6", "7", "8", "9",
"10", "Jack", "Queen", "King", "Ace", };
char suit[4] [9]= {"Diamonds", "Hearts","Spades", "Clubs"};
for (i = 0; i < 52; i++)
{
printf("Card = %s \t %s ", face[i % 13], suit[i / 13]);
}
return 0;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
