a) Make a 4x13 2D array ofstrings. b) Each card will be representedby a string “
ID: 3610562 • Letter: A
Question
a) Make a 4x13 2D array ofstrings.
b) Each card will be representedby a string “Suit-Rank”, for example:“Clubs-2”, “Diamonds-Jack”,“Hearts-Ace”, “Spades-10” etc.
c) Populate the 2D array, printits content
string cards[4][13]; //it is important tohave it as 2D string
string suit [4] = { "Clubs", "Diamonds", "Hearts", "Spades" };
string rank [13] = { "Ace","2", "3", "4", "5", "6", "7", "8", "9", "10", "Jack","Queen", "King" };
for (inti=0;i<4;i++)
{
for (intj=0;j<13;j++)
{
cards[suit][rank];}
}
string cards[4][13];
string suit [4] = { "Clubs", "Diamonds", "Hearts", "Spades" };
string rank [13] = { "Ace","2", "3", "4", "5", "6", "7", "8", "9", "10", "Jack","Queen", "King" };
for (inti=0;i<4;i++)
{
for (intj=0;j<13;j++)
{
cards[suit][rank];}
}
Explanation / Answer
please rate - thanks this should get you started #include #include #include using namespace std; void shuffle(int[][2]); void shuffle2(int[][2]); int main() { int i,j,deck[52][2]; int hands[10][5][2],totalhands=0; string suit[4]={"hearts","diamonds","spades","clubs"}; stringcard[13]={"ace","2","3","4","5","6","7","8","9","10","jack","queen","king"}; srand(time(0)); shuffle(deck); coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.