Assignment #6 - Array Practice

Due: Thurs, Nov 16

Objective

To gain practice with arrays and common array algorithms, as well as the use of array parameters in functions.

Task

This assignment will consist of writing several functions that manipulate arrays or access data from arrays, as well as a test program that will allow interactive testing of the array functions.

Part 1: Functions

Write the following functions. Each one takes in an integer array as a parameter, and other necessary parameters are returns are described. Make sure the parameters are in the order specified. Make sure to use the const qualifier on the array parameter on any function where it is appropriate. A sample CALL is given for each function. Note that none of these functions do any keyboard input or screen output.
 

Part 2: Test Program

To help you test and get you started, I've provided you with a starter file, which you can download from this link. The starter file already contains the PrintArray function that we looked at in lecture class, as well as a function called FillArray that allows the user to enter values into an array from the keyboard. You may use these functions in writing the following test program.

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
Hint: A good way to implement a menu loop is a switch statement (for processing a menu selection) inside of a do-while loop (for repeating the menu selection process).
 

General Requirements


To see an example of the menu program running interactively, you can run my version of the executable from your own CS account with the command:
  ~myers/c++prog/menu6

Submitting:

Submit as usual with the appropriate script. This one will be submit6:
 ~myers/csub/submit6 hw6.cpp