Question: C++ / Linked List Manipulations Develop a program that will maintain an ordered linked list of positive whole numbers. Your program will provide for the

C++ / Linked List Manipulations

Develop a program that will maintain an ordered linked list of positive whole numbers. Your program will provide for the following options:

a. Add a number

b. Delete a number

c. Search for a number

d. Display the whole list of numbers

At all times, the program will keep the list ordered (the smallest number first and the largest number last).

At the start of the program, the list will be empty. The user will add new numbers by choosing the "add" option and will supply the number to be included in the list. The program will add the number to the list at the appropriate position in the linked list so that the list will remain ordered.

If the number being added is already in the list, the program will display a message: "Duplicate number. Not added to the list". This will ensure that the list does not contain any duplicate numbers.

For removing a number from the list, the user will choose the "delete" option and supply the number to be removed. If the number is in the list, it will be eliminated from the linked list. Otherwise, a message will be displayed: "Number is not in the list". For looking up a number in the list, the user will choose the "search" option and will provide the number to be found. If the number is in the list, the program will display : "the number is in the list". Otherwise, it will display: the number is not in the list".

For printing, the complete list of numbers, the user will select the "display" option. This option will display the list of all the numbers in the list. It should be an ordered list of unique numbers.

Instructions: Use the following structure for storing each number. struct entry { int number; entry * next; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!