Question: Use C++ sort each player's hand in ascending order and display their hand using text descriptions instead of numbers as shown in the example. Add

Use C++

sort each player's hand in ascending order and display their hand using text descriptions instead of numbers as shown in the example.

Add code to the program down below

#include  #include  #include  #include  #include   using namespace std; void unwrap(vectorint> &); void shuffle(vectorint> &); //cards from top of deck are deal to playes //cards for each player are stored in array void dealCards(int array[][13],vectorint> &deck); //display cards of each player void showHand(int array[][13]); int main() { int cardsDealt[4][13];//store the cards of each player   srand(unsigned(time(0))); vectorint> deck; unwrap(deck); cout" Before random shuffling "; for(vectorint>::iterator i=deck.begin();i!=deck.end();++i) cout" "" After random shuffling "; for(vectorint>::iterator i=deck.begin();i!=deck.end();++i) cout" "//deal cards to each player  cout" After dealing cards "; showHand(cardsDealt);//show cards of each player  return 0; } void shuffle(vectorint> &deck){ random_shuffle(deck.begin(),deck.end()); } void unwrap(vectorint> &deck){ int i; for(i=0;ivoid dealCards(int array[][13],vectorint> &deck){ int i,j; for(i=0;ifor(j=0;j//fill column by column ie to each player in a round   array[j][i]=deck.back(); deck.pop_back(); } } } void showHand(int array[][13]){ int i,j; for(i=0;i//display row by row  cout"Player "" cards:"; for(j=0;j" " 

Out put example

Use C++ sort each player's hand in ascending order and display their

Hand 1 holds f Spades 3 o Jack of Spades Queen of Spades 2 of Hearts 7 of Hearts 8 of Hearts Queen of Hearts Ace of Diamonds 3 of Diamonds Jack of Diamonds Queen of Diamonds 4 of clubs King of clubs Hand holds f Spades 4 o f Spades 6 o 10 of Spades Ace of Hearts 3 of Hearts 5 of Hearts 6 of Hearts 10 of Hearts Jack of Hearts 7 of Diamonds 2 of clubs 7 of clubs Queen of clubs Hand holds 5 of Spades 7 of Spades f Spades 8 o 9 of Spades King of Spades 4 o earts 2 of Diamonds 4 of Diamonds 9 of Diamonds Ace of Clubs 6 of clubs 8 of clubs Jack of clubs Hand holds Ace of Spades 2 of Spades 9 of Hearts King of Hearts 5 of Diamonds 6 of Diamonds 8 of Diamonds 10 of Diamonds King of Diamonds 3 of clubs f Clubs 5 o 9 of Clubs 10 of Clubs

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!