/********************************************************************************************
ex2a.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 declaration
ParseAndPrint(Values, MaxListSize);
int CurrentInput;
for (int n = 0; n < MaxListSize; n++)
{
if (cin >> CurrentInput)
Values[n] = CurrentInput;
else
break;
//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;
}