Problem:
Write an ordered linked list C++
program to store a list of address structs,
where each struct contains a name (last, first), address, and
telephone number.
The list should be in ascending to
the last name.
Assume that it is an empty list in the
beginning, after user enter a record, you start to insert
user's information in. Where to insert
it depends on the last name. For examples, if user enter
the following three records, you will insert the second one after the
first one.
When the third one comes, you will insert it between last two records.
Name
Address
Phone Number
Adam, Pascal
123 First Ave. 38102
432-5612
Waters, Kim
781 Knight-Arnold st.38126 807-1234
Farmer, Dawn
2889 Felix Ave. 38111
547-1109
You should be able for any one to update
the list by inserting a new record
from keyboard
or deleting an existing record
from list.
In addition, the list can be printed whenever needed.
Suggestions:
I. Write a main()
function to do the following jobs:
1. Show the following paragraph on the screen:
Enter S or s to show the list contents
Enter A or a to add a node to the list
Enter D or d to delete a node from the list
Enter Q or q to quit the program
Make
your selection:
2. Store the user's choice.
3. According user's choice, write a switch
statement to call individual function
that will complete the job on the menu.
4. User will continue to make a selection except quitting.
II. Write the following general functions:
//PROTOTYPES
void
GetInfo(Node &N); //GETS NODE INFORMATION FROM USER
void
ShowList(list<Node> &L); //DISPLAYS LIST CONTENTS
void
AddNode(list<Node> &L); //ADDS A NODE TO THE LIST
void
DelNode(list<Nod> &L); //DELETES A NODE FROM THE LIST