Assignment 10 Solution

$30.00 $26.70

Description

Program details

When playing poker and other card games (standard 52 cards, excluding the jokers), it is usual to arrange a hand to reflect its values. Write a program in C that arranges and prints out a random hand of ten cards in sorted order by pips values. Assume that an ace is highest in value, a king is next highest, which is followed by a queen, a jack, and so forth. For cards of the same pips values, use their suits to sort them in the order of Clubs, Diamonds, Hearts, and Spades. Notice that no card shows more than once in a hand.

In order for the hands of cards dealt by the program to be truly random, have the following line at the beginning of your program: (You need #include <time.h> though.)

srand(time(NULL));

The following screen shot contains two sample outputs of the program.

You are asked to use ch7/test_drive.c as your reference for using a “comparator” function and qsort() to sort your cards.

Although it is totally up to you how you design your program, it needs to satisfy the following rules:

  • It consists of at least 3 source files (.c files) and at least 3 header files (.h files).

  • It uses structures and enums to model poker cards.

  • It is organized in the following way:

    • bin_files/ : a subfolder that holds executable file(s)

    • obj_files/ : a subfolder that holds object file(s)

    • inc_files/ : a subfolder that holds header file(s)

    • src_files/ : a subfolder that holds source file(s)

  • It comes with a workable makefile.

What to submit?

Create a tarball by the name of cs3335_a10_yourlastname.tar that contains your entire program folder.

Submit the tarball file through BlazeVIEW by the due time.