C.I.S. 1.5

Brooklyn College

Professor Langsam

 

Assignment #5

 

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 (first and last), followed by his/her seating. 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 also been. 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.txt placing the names in a one-dimensional array and the seating positions in another 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.

 

Note: first name, last name, and title may be combined into a single string using the string concatenation operator (+). For example, in C++ one may write:

 

     name = title + first + ' ' + last;

 

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                    ?