QP10 - corresponding cards 200 times Finally your program...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Quiz Program #10 Program Description: Cards Write a program that creates a deck of cards utilizing the following struct: struct card { char suit; char kind; }; Your program should use the character 'S' for spades, 'H' for hearts, 'D' for diamonds and 'C' for clubs to encode the suit. You should encode the kind with one of the following characters: '2', '3', '4', '5', '6', '7', '8', '9', 'T', 'J', 'Q', 'K', 'A' where the last four characters represent a ten, jack, queen, king and ace, respectively. Your program should create an array of size 52 of this struct. Then, it should randomly shuffle the deck by picking two random numbers from 0 to 51 and swapping those
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: corresponding cards 200 times. Finally, your program should output four hands that are dealt for a game of Hearts. The first hand is stored in array indexes 0-12, the second in indexes 13-25, the third in indexes 26-38 and the last hand is stored in indexes 39-51. Here is some sample output from running the program: Hand 1: 3D 6D KS 2D 5H TH 8S JS QS 3H TC 2S 8C Hand 2: AS 5S 7S QH 3C 9D JH KC QC 8D 3S 6S 4D Hand 3: 2H TS JD 8H 2C 9S 9C 4S 9H 6C TD AD JC Hand 4: AC AH 4C KD KH 7D 6H 5D 7H QD 5C 7C 4H...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online