// Suppose the array "list" is {2, 4, 6, 8, 10, 12} Insert(list, 6, 100, 3); // insert the value 100 at index 3. // "list" is now {2, 4, 6, 100, 8, 10}
// Suppose the array "list" is {2, 4, 6, 8, 10, 12} Delete(list, 6, 2); // delete the value at index 2. // "list" is now {2, 4, 8, 10, 12, 0}
// Suppose the array "list" is {2, 4, 6, 8, 10, 12} Reverse(list, 6); // Reverse the array "list" // "list" is now {12, 10, 8, 6, 4, 2}
// Suppose "list" is {2, 5, 5, 10, 5, 10, 3, 4, 5, 9, -1, 6} HowMany(list, 12, 5) // returns how many times the value 5 appears // in array "list". This call returns 4 // because the value 5 appears 4 times.
// suppose "list" is {1, 3, 4, 6, 9, 10, 12, 0, 5, 11, -3} SumOdds(list, 11, 4); // this call should return the value 18 SumOdds(list, 11, 8); // this call should return the value 26 // (there are fewer than 8 odd numbers)
Write a main() function that creates an array of size SIZE (a constant given in the starter file) and initializes all of the array elements to 0 to start. Since this SIZE is a constant, it can be changed for testing different sizes of arrays easily. Use this constant whenever referring to the array's size from main() (instead of using a hard-coded literal value).
Then, the program should go into a menu loop, presenting the user with the following menu the first time:
** Given features ** P Print the array contents F Fill the array (user entry) ** Function Tests ** I Insert D Delete R Reverse H HowMany S SumOdds M Print this menu Q Quit this program
Enter your menu selection:
The sum of the first 5 odd numbers is: 18
The value 6 appears in the list 3 times
~myers/c++prog/menu6
~myers/csub/submit6 hw6.cpp