//this program uses a function to double the value of 
//each element of an array.
#include <iostream>
using namespace std;

//function prototypes
void doubleArray(int [], int);
void showValues(int [], int);

int main()
{
	const int ARRAY_SIZE = 7;
	int set[ARRAY_SIZE] = {1, 2, 3, 4, 5, 6, 7};
	
	//display the initial values.
	cout << "The arrays values are:\n";
	showValues(set, ARRAY_SIZE);
	
	//double the values in the array.
	doubleArray(set, ARRAY_SIZE);
	
	//display the resulting values.
	cout << "After calling doubleArray the values are:\n";
	showValues(set, ARRAY_SIZE);
	
	return 0;
}

//***************************************************
// definition of function doubleArray				*
// this function doubles the value of each element	*
// in the array passed into nums. the value passed	*
// into size is the number of elements in the array	*
//***************************************************

void doubleArray(int nums[], int size)
{
	for (int index = 0; index < size; index++)
		nums[index] *= 2;
}

//***************************************************
// definition of function showValues.				*
// this function accepts an array of integer and	*
// the array's size as its arguments. the contents	*
// of the array are displayed.						*
//***************************************************

void showValues(int nums[], int size)
{
	for (int index = 0; index < size; index++)	
		cout << nums[index] << " ";
	cout << endl;
}
