|
|||
Bridge HandsMany games, such as bridge, involve dealing a standard deck of 52 cards to 4 players, so each receives 13 cards. Good players can then play with the hand as it is dealt, but most ordinary players will need to sort it, firstly by suit, and then by rank within suit. There is no fixed ranking of the suits for this purpose, but it is useful to alternate the colors, so we will presume the following ordering: clubs < diamonds < spades < hearts. (Note that from now on we will use the more conventional C, D, S, H). Within a suit, ace is the highest, so the ordering is 2 < 3 < 4 < 5 < 6 < 7 < 8 < 9 < T < J < Q < K < A. The players are usually designated North, South, East, and West, and they sit at the points of the compass they name. One player is designated the dealer and he (or she) deals one card to each player starting with the player on his (her) left hand and proceeding clockwise until he (she) deals the last card to himself (herself). Write a program that will read in a presentation of a deck of cards, deal them, sort them, and then display the 4 sorted hands in the format shown below. Input Specification
The input will consist of a series of deals. Each deal will consist of the letter
representing the dealer ( Output SpecificationOutput will consist of a series of sets of four lines, one set for each deal. Each set will consist of four lines displaying the sorted hands, in the order and format shown below. Sets must follow each other immediately, with no blank lines between them. Sample Input
Output for Sample Input
|
|||
University of Debrecen; Faculty of Informatics; v. 09/30/2024 |