Write a program to manipulate data in an array
Should begin with the prompt:
"DATA CONFIRMATION AND UPDATE PROGRAM WRITTEN IN C"
"Program written by XXXXXX."
"Program compiled on XXXX at XXXX."
"Here is what data set 1 looks like now:"
[ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ]
4 7 6 32 5
"Here is what data set 1 looks like now:"
[ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ]
98 47 26 99 187
"which data set do you want to work with [ 1 or 2 ]:"
Create the two arrays in a new header file and initialize them to the values shown.
Make the arrays to hold the data 20 elements long, using a symbolic constant to set that value.
After the user selects one of the data sets to work with, allow them to keep interacting with that
data set until they indicate they want to change it.
Offer the user the following menu
"DATA CONFIRMATION AND UPDATE PROGRAM"
1. Display data set now.
2. Delete an entry from the data set.
3. Add an entry to the end of the data set.
4. Change an existing entry.
5. Quit this program.
"Enter choice [ 1-5, 0 = change data set]:"
Each of these should be done in its own function. Cohesiveness counts!
For the display data set, use the same function you wrote that displays it when the program
begins.
For deleting an entry, prompt the user with
"Which entry do you want to delete [ 1-5, 0=return to Menu ]:"
and allow them to enter a 1, 2, 3, 4, or 5, or a zero, which will do nothing and return to the main
menu. After you remove the element, move the remaining elements over to fill in the hole. For
example,
"Here is what data set 1 looks like now:"
[ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ]
4 7 6 32 5
"Which entry do you want to delete [ 1-5, 0=return to menu ]: 3
Deleting entry 3."
"Here is what data set 1 looks like now:"
[ 1 ] [ 2 ] [ 3 ] [ 4 ]
4 7 32 5
Note that when we display the elements, we start with entry 1, not zero. Internally, of course, you
need to be aware that our arrays always start with element 0.
Adding an entry will just put a value at the end of the list.
Changing an existing entry will allow the user to directly modify a value that's already there.
"Here is what data set 1 looks like now:"
[ 1 ] [ 2 ] [ 3 ] [ 4 ]
4 7 32 5
"Which entry do you want to change [ 1-4, 0=return to menu ]: 3
Existing entry 3 has the value 32."
"New Value: 94"
"Entry 3 now has the value 94."
"Here is what data set 1 looks like now:"
[ 1 ] [ 2 ] [ 3 ] [ 4 ]
4 7 94 5
***I tried to format it so the prompt displayed by the program appears in quotes and the lab text itself falls respectively inbetween each section***
I have one header file already that I can use to display the programmer, date and time portion.
Let me know if I can clarify further.
This post was edited by JabbyG on Mar 15 2018 09:52am