Problem:
Write a C++ program that will ask the user to enter not greater than to 15 numbers (decimal numbers are accepted). Please observe the output format below. Trace the program from logic to syntax especially for no inputs and inputs that have zeros (0s). Take note as well that if the data to be searched in element, index, or value is not found, the program will display “No such data located!”. Hint: for menu I, you can use any of the sorting algorithms such as insertion sort, selection sort, bubble sort, and the rest.
Output:
-------------------------------------------------------------------------------------------------------------------------------------------
MAIN MENU:
[C]Input Values
[P]Display Elements, Index, and Values
[R]Search by Element
[O]Search by Index
[G]Search by Value
[I]Sort the Values
[T]Display the Member’s Complete Names with Course, Year, & Section
[E]Exit
Your choice is:
--------------------------------------------------------------------------------------------------------------------
SAMPLE MENU ACTIONS:
--------------------------------------------------------------------------------------------------------------------------------------------
If user opts to choose C:
Enter 15 numbers: 1 2 3 4 5 6 7 8 9 10 11 12.1 13 14 1
Return to Main Menu? Y or n for yes to exit the program, N or n for no and exit the program.
--------------------------------------------------------------------------------------------------------------------------------------------
If user opts to choose P:
Element Index Value
1 0 1
2 1 2
3 2 3
4 3 4
5 4 5
6 5 6
7 6 7
8 7 8
9 8 9
10 9 10
11 10 11
12 11 12.1
13 12 13
14 13 14
15 14 1
Return to Main Menu? Y or n for yes to exit the program, N or n for no and exit the program.
--------------------------------------------------------------------------------------------------------------------------------------------
If user opts to choose R:
Search by element: 2
2 is located at index 0 with the value 1
Return to Main Menu? Y or n for yes to exit the program, N or n for no and exit the program.
--------------------------------------------------------------------------------------------------------------------------------------------
If user opts to choose O:
Search by index: 10
10 is located at element 11 with the value 11
Return to Main Menu? Y or n for yes to exit the program, N or n for no and exit the program.
--------------------------------------------------------------------------------------------------------------------------------------------
If user opts to choose G:
Search by value: 1
1 is located at element 1 and 15 and at index 0 and 14
Return to Main Menu? Y or n for yes to exit the program, N or n for no and exit the program.
--------------------------------------------------------------------------------------------------------------------------------------------
If user opts to choose I:
Sorted values are: 1 1 2 3 4 5 6 7 8 9 10 11 12.1 13 14
Return to Main Menu? Y or n for yes to exit the program, N or n for no and exit the program.
--------------------------------------------------------------------------------------------------------------------------------------------
If user opts to choose T:
The members are Henry William Gates and Grace Murray Hopper, BSIT 2D
Return to Main Menu? Y or n for yes to exit the program, N or n for no and exit the program.
--------------------------------------------------------------------------------------------------------------------------------------------
If user opts to choose G:
Do you want to close the program? Y or n for yes to exit the program, N or n for no, and return again to the main menu.
--------------------------------------------------------------------------------------------------------------------------------------------


LinkBack URL
About LinkBacks




Reply With Quote






Bookmarks