CS35: Assignment 18

CS35: Programming and Problem Solving
Ray Ontko
Department of Computer Science
Earlham College

Due Friday, 1999/11/05

Reading Assignment

Read sections 6.5 through 6.8 in Deitel and Deitel. Optionally, read section 1.9 in Kernighan and Ritchie.

Programming Exercise

Modify the sample program deck.c to simulate a deal of the entire shuffled deck out to each of four hands (called north, east, south, and west, if you like). Then, sort and print each of the four hands.

For example:

$ ./deal_bridge

North

Ace of Spades
Jack of Spades
Nine of Spades
Eight of Spades
Five of Spades
Three of Spades
Jack of Hearts
Five of Hearts
King of Diamonds
Ace of Clubs
King of Clubs
Ten of Clubs
Three of Clubs

East

King of Spades
Ten of Spades
Four of Spades
.
.
.

Note the order of the suits and cards in the example above. For fun, sort and print the hands in order of descending rank within descending suits. (Hint: you can accomplish this with small changes to sort_hand() and print_card()).

Copyright © 1999, Ray Ontko (rayo@ontko.com).