/********************************************************************************************
ex2.cpp
Jim Millard
for CO311
More basic array processing
********************************************************************************************/
#include <iostream>
#include <string>
using namespace std;
void ParseAndPrint(char [], int);
void ParseAndPrint(int [], int);
void main()
{
const int MaxListSize = 10;
int Values[MaxListSize];
//show each element of the array after initialization
ParseAndPrint(Values, MaxListSize);
int n=0;
int CurrentInput;
while ((n < MaxListSize) && (cin >> CurrentInput))
{
Values[n] = CurrentInput;
n++;
//show each element of the array, ever pass of the loop
ParseAndPrint(Values, MaxListSize);
}
//show each element of the array after exiting the loop
ParseAndPrint(Values, MaxListSize);
}
void ParseAndPrint(char array[], int size)
{
for (int i = 0; i < size; i++)
cout << array[i];
cout << endl;
}
void ParseAndPrint(int array[], int size)
{
for (int i = 0; i < size; i++)
cout << array[i] << ' ';
cout << endl;
}