![]()
Compile and run the program pointplay.cpp.
Copy the output into your README file and explain each line of output.
Several changes must now be made in the rest of the code since pointers are
used. Make the program compile and execute.
The program clublist.cpp is supposed to read in names and ids from a file and put them into an vector of pointers, but it currently does not do much. We would like to be able to print the list sorted by names and also sorted by ids. We will first focus on the names and getting them into the array. Later we will focus on reading them in sorted, and then sorting them by ids.
Modify the program as follows:
Using the data file clublist.data your club vector should look like this:
Compile and run to make sure this part works before moving on.
Compile and run to make sure this part works before moving on.
Using the data file clublist.data your club vector should look like this (note it is sorted by name, the 0 pointer points to the first in alphabetical order):
Compile and run to make sure this part works before moving on.
Using the data file clublist.data your club and clubID vectors should look like this (note club is sorted by names and clubID is sorted by IDs):
You'll have to make several changes to do this.
Modify the main function to include a second tvector of type Person
* named clubID. Pass this tvector to ReadInput, which passes it on to
InsertPerson.
| Modify InsertPerson to also insert into the clubID array. Note that
the memory of the person and id can be shared, so you are really only
inserting a pointer.
| In the main function, print the list sorted by name with a comment
indicating this, and also print the list sorted by id, again with a
comment indicating this. | |
![]()