// sumLoopEOFArray.cc  P.Conrad for CISC181 Spring 2007
// Read integers from stdin, one per line, ending with EOF (end of file)
// Output the sum (with no special labels---just a bare number)

#include <iostream>
using namespace std;

void  printArray(int array[],int size)
{
  for ( int i=0; i<size;  i++ )
    {
      cout << array[i] << " ";
    }
  cout << endl;  
}

int main()
{
  // initialize sum and declare variable to hold the input

  int thisNum;

  const int MAXSIZE = 100;
  int nums[MAXSIZE]; // an array that can store up to 100 nums
  int count = 0;

  // read all data into my array
  cin >> thisNum;
  while ( !cin.eof() ) // eof() is a "member function" for the object cin
    {
      nums[count] = thisNum;
      count ++; // increment AFTERWARDS... why?  @@@ We'll say on thursday...
      cin >> thisNum; // read the next number
    }
  
  // see if it worked

  printArray(nums,count);

  return 0;
}




