Write a C++ code which will display the following menu,

1.Read a list of numbers.
2.Display list.
3.Save list to File.
4.Load list from file
5.Search for a given number in the list.
6.Reverse list.

7.Calculate the sum of the list.

8.Calculate the average of the list.

9.Find the largest number in the list.

10.Find the smallest number in the list.


Hence the program will read the choice enter
ed from the keyboard and a
statement will proceed according to the choice of the user
(described below)
. If the
choice is not valid an appropriate message should be displayed.
The program
return back to the main menu after the completion of any selection
and will only be terminated when the Exit Program is selected.
Choices 1 to 10 will call appropriate functions to do the following:

Prompt the proper messages for the user to enter the
number of integers to be
entered and then the integer numbers should be entered in sequence and stored
in an array of integers.
2.Display the list of
integer numbers stored in the array. This option will only be
executed if the array is not empty and it
has been loaded with numbers either
entered from the keyboard or loaded from a file.

3.Save theinteger numbers of the array in a text file.

4.Load the numbers from the file in the array.

5.The user will be prompted to enter an integer number to be searched in the array
and the function will search to find the given number in the array and respond
with a message
hether or not the number is found in the list, how many times
the number is repe
ated in the list and the position(s) where the number is found
in the list.

6.Reverse the order of the list.

7.Calculate the summation of the integer numbers of the list.

8.Calculate the average of the numbers in the list.
This function will use the function created in option 7 above and just divide the result returned from the
function of option 7 with the number of numbers in the list.

9.Find and display the largest number in the list and the position where the number
is located in the list
10.Find and display the smallest number in the list and the position where the
number is located in the list.

Recommended Answers

All 2 Replies

Do the requirements one at a time, don't attempt to code it all at once. First, code the menu, comple, fix any errors, and repeat until it works correctly. Then you are ready to code the next requirement, repeating the same steps you did for the menu. In the meantime you are free (encouraged) to post code and ask questions about what you don't understand or how to fix something that doesn't work right.

If you can show us some code about your quest, maybe we may help you achieve your goal.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.