Write a program to perform the following the following card trick. The program must deal out the cards in three columns,

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Write a program to perform the following the following card trick. The program must deal out the cards in three columns,

Post by answerhappygod »

Write a program to perform the following the following cardtrick. The programmust deal out the cards in three columns, row by row.Ace of Hearts Jack of Spades 7 of Clubs2 of Spades 2 of Spades 3 of Spades3 of Diamonds 4 of Diamonds 10 of Hearts10 of Clubs 8 of Hearts 9 of DiamondsJack of Hearts 9 of Clubs Jack of ClubsQueen of Clubs Queen of Hearts King of Diamonds7 of Diamonds King of Spades 6 of clubsThe program must then prompt the user to pick which column his/hercard is in.Your program should then pick up that column second, that is: pickup eitherremaining column first, the selected column, and then the finalcolumn.In the example above, assume that the selected card is the Ace ofHearts. Theuser would select column 0. Your program should pick up column 1,then column0, and finally column 2. Then it must redeal the cards, whichshould look like:Jack of Spades 2 of Spades 4 of Diamonds8 of Hearts 9 of Clubs Queen of HeartsKing of Spades Ace of Hearts 2 of Spades3 of Diamonds 10 of Clubs Jack of HeartsQueen of Clubs 7 of Diamonds 7 of Clubs3 of Spades 10 of Hearts 9 of DiamondsJack of Clubs King of Diamonds 6 of ClubsYour program should repeat this process twice more (selecting thecolumn,picking up and redealing). Then the program must deal out the firstten cardsin the deck and declare the eleventh card as the secret card.Sample Output of the Trick:Column 0 Column 1 Column 2=======================================================9 of Clubs 7 of Clubs 8 of Hearts6 of Spades Jack of Clubs King of SpadesJack of Hearts 4 of Diamonds 8 of Diamonds6 of Hearts Jack of Diamonds 8 of Spades8 of Clubs King of Clubs 9 of Hearts4 of Hearts Ace of Clubs Ace of Spades10 of Diamonds 5 of Spades 3 of DiamondsWhich column is your card in (0, 1, or 2)?: 1Column 0 Column 1 Column 2=======================================================9 of Clubs 6 of Spades Jack of Hearts6 of Hearts 8 of Clubs 4 of Hearts
10 of Diamonds 7 of Clubs Jack of Clubs4 of Diamonds Jack of Diamonds King of ClubsAce of Clubs 5 of Spades 8 of HeartsKing of Spades 8 of Diamonds 8 of Spades9 of Hearts Ace of Spades 3 of DiamondsWhich column is your card in (0, 1, or 2)?: 2Column 0 Column 1 Column 2=======================================================6 of Spades 8 of Clubs 7 of ClubsJack of Diamonds 5 of Spades 8 of DiamondsAce of Spades Jack of Hearts 4 of HeartsJack of Clubs King of Clubs 8 of Hearts8 of Spades 3 of Diamonds 9 of Clubs6 of Hearts 10 of Diamonds 4 of DiamondsAce of Clubs King of Spades 9 of HeartsWhich column is your card in (0, 1, or 2)?: 0Finding secret card...8 of Clubs5 of SpadesJack of HeartsKing of Clubs3 of Diamonds10 of DiamondsKing of Spades6 of SpadesJack of DiamondsAce of SpadesYour secret card is: Jack of ClubsProgram RequirementsYour program must generate its own random deck of cards using thefollowing technique: generate a random integer for each card display a string value for each card ("Ace of Diamonds") use the rand() function to generate integer card values use the srand(time(0)) command (only once at the beginning of theprogram) to generatea truly random deck once the program has been tested and runsproperly.Each value must be converted to the format <rank> of<suit> as done in the exampleabove. Whenever your program displays the cards they must line upas they doabove, on the word "of".Your program must deal the cards out by row and pick them up bycolumn (3 timesto make it work properly).Your program must ask the player is he/she wants to printout theentire deckbefore playing. Each card must be printed out formatted asabove.
Your program must ask the player if he/she wants to play again,and continue playing as manytimes as the player wants.The program must ask the player for his/her name and refer to theplayer by namethroughout the playing of the game.Your program code must be logically organized using functions. Youalso mustuse the starter file provided. You will GET A ZERO (0) if you donot use thestarter file!
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply