What is the code for the following?

1. Create three source files (asgn6.h, casgn6.cpp and
asgn6Driver.cpp), an object file (asgn6.o) and an executable
(asgn6Driver) in your bin directory on Linux 3 server.

2. Provide the user with a menu with the following options:
List Operations
===============
1.Insert
2.Display
3.Size
4.Delete
5.Exit
Enter your choice :

3. Overload the Insert method; one that accepts first and last name. Another that accepts
the last name only.

4. The driver program interacts with the user through the menu. Do not allow the user to
exit unless option '5' is input. Advise the user of an invalid input if the user does not
input values 1 through 5. If the user inputs a valid option, perform the action and
display the menu for the user to enter another choice.

5. The following is a summary of actions for each menu option:
option 1 - prompt the user for a first and last name and insert this information in a single linked list in alphabetical order based on last name.
option 2 - display the data to the console one node per line.
option 3 - display the number of nodes in the list.
option 4 - prompt the user for the last name to delete. delete the node otherwise
advise that a node was not deleted.
option 5 - exit the program
what specific question do you have and what have you got so far?
Can you give me an example of what one node per line is? Also, how do you delete a node?
Last edited on
it looks like each node in your list will be 2 strings, a first name and a last name.
one node per line implies to me your output would look like this maybe:


Smith, John
Jones, Bob
Taylor, Sue


do you have to write the linked list yourself? if so:
http://www.codeproject.com/Articles/24684/How-to-create-Linked-list-using-C-C

where your node might look like this:
1
2
3
4
5
6
7
8
9
Linkedlist Node {

    // The value or data stored in the node
    std::string firstName;
    std::string lastname;
    
    // A reference to the next node, null for last node
    next; 
 }
Last edited on
What would be the option if I didn't have to create it, because it might be built in?
Thanks
Topic archived. No new replies allowed.