Manipulating a List of Integer Values # Manipulating a List of Integer Values Program

Directions:
Write a program that will allow the user to manipulate a list of Integer values.
The program will need to have a looping menu with the following options: add values, remove a value, remove a location, insert a value, clear list, get size, get index, print, total, average and exit.  Make sure to set up the list and the functions required, then use the main function to set up the menu and call each function using an if statement for each possible choice in the menu.
Menu Options:
Add values – add values until 0 is entered
Each value is added to the end of the list.
Zero is not added.
Change a value –Changes the value at a given location.
Prints an error if the index is invalid.
Insert a value – Adds a single value at a given location.
Prints an error if the index is invalid.
Get Index – Prints the value at a given location.
Prints an error if the index is invalid.
Get Size – Prints the number of elements in the list
Print – Displays all the values in the list
Total – Prints the total of all the values in the list
Average – Prints the average of all the values in the list
Remove a value – Attempts to remove a value given.
If the remove was successful print “remove successful”
If the remove was unsuccessful print “value not found”.
Remove a location – Removes the value at a given location and prints the value that was removed.
Prints an error if the index is invalid.
Clear – Empties the list
Exit – Exits the program

Comments

Leave a Reply