C.I.S. 1.5

Brooklyn College

Professor Langsam

 

Assignment #6

 

The head maid to the President has asked you to prepare a computer listing of the individuals who are to attend the upcoming Presidential Ball, and the order in which they are to be seated.

 

Her problem is the following- she has one line typed for each individual with his/her name in columns 1-30, and his/her seating position in columns 47/48. In order to distinguish males from females and singles from those married, the digit 1 for "Mr.", 2 for "Mrs.", 3 for Ms." and 4 for "Miss" have been entered in column 60. Unfortunately, the invitations were accidentally jumbled by the president's wife and the head maid refuses to sort them by hand.

 

Write a C program to read a file called party.dat, placing the names in a one-dimensional array and the seating positions with the guest's title code in another two-dimensional array. Then sort both arrays according to seating position (from first to last) and change each person's name by adding the title Mr., Mrs., Ms., or Miss in front of it. Make sure there is only one blank between the title and the name.

 

Print the sorted arrays so that there is one individual printed on a line. Print her/his number followed by her/his name (now with the appropriate title). Do not print out the digits 1, 2, 3 or 4.

 

Use the following data:

 

            Baby Bop                                               8                    4

            Paul Reiser                                           10                    1

            Whoopi Goldberg                                   5                    3

            Oprah Winfry                                         9                    2

            Riki Lake                                               6                    2

            Bruce Springsteen                                 11                    1

            Kenny G                                                3                    1

            Erica Kane                                           15                    3

            Stephano Dimera                                    4                    1

            Cookie Monster                                     2                    1

            Big Bird                                                14                    4

            Lt. Whorf                                             12                    1

            Diana Troi                                              7                    4

            Rosanne Barr                                       13                    3

            your name                                             1                    ?