OK, maybe I'm just dense, or slow, or overtired. However, I do
not seem to be able to get my head around this textbook question that is assigned as homework. On a weekend, getting an answer from my professor or classmates is obviously not going to happen, so I am hoping that y'all can give me a kickstart in explaining what I need to do here..This is the question literally transposed from the book (I added italic emphasis where I am confused):
You're working for a company that wants to take client contact information as it is entered by a salesperson from a stack of business cards that he or she has collected, and output the information to a file (contacts.dat) in alphabetical order. Assume that there are nver more than 100 cards to enter. The program should prompt the salesperson for each of the following values for each card:
Last name
First name
Middle name or initial
Title
Company name
Street address
City State
Zip code
Phone number
Fax number
Email address
After the data are entered for each card, the user should be asked if there is another cad to enter. This data should be sorted by last name, using a version of the SortedList class from Chapter 13 that will hold up to 100 struct values, each with a number corresponding to an iterm in the list above. Because the struct is so large, however, it will be more efficient if each element of the list array is a pointer to one of the struct values, and the class merely rearranges the pointers within the array in order to do the sorting. You should dynamicaly create a new
struct for each component of the list array to point to as the cards are input. Thus, the program won't allocate struct memory for any more cards than ar entered. The print function of the class will need to be modified to output the list to the contacts.dat file instead of cout. Each member of the struct should be written on a separate line. The function should also write the number of cards that are in the list as the first line of the file.
OK, so...I'm not really overwhelmned here with what I'll need to do so much as just missing the point of clarity on what is wanted. Is this question essentially saying "rewrite what already exists to be an array of structures", or? I've attached the header file of the class that's referenced in the question, just for clarity. I am inclined to edit the SortedList class to typecast a struct type, and change the private data array to handle it, but then this is where I start getting confused about the pointers excercise (which in this case, really should be a pointers excercise since the chapter primarily covered pointers)..
PLEASE, I'm not asking how to code anything here, not even asking for pseudo-code, but rather what is the reasonable paraphrase of what this question is asking?
Thanks!!!