/* This program illustrates the use of a function template to
 * display an array with elements of any type for which << is
 * defined.
 *
 * Output:  An array of ints and an array of doubles using Display()
 *******************************************************************/

#include <iostream>
using namespace std;

/* Function template to display elements of any type
 * (for which the output operator is defined) stored
 * in an array.
 *  Receive: Type parameter ElementType
 *           Array of elements of type ElementType
 *           numElements, number of elements to be displayed
 *  Output:  First numElements in array
 ****************************************************************/

template <class ElementType>
void Display(ElementType array[], int numElements)
{
  for (int i = 0; i < numElements; i++)
    cout << array[i] << "  ";
  cout << endl;
}

int main ()
{
  double x[10] = {1.1, 2.2, 3.3, 4.4, 5.5};
  Display(x, 5);
  int num[20] = {1, 2, 3, 4};
  Display (num, 4);
}

