// minOfNums.cc pconrad CISC181 02/10/06
// read numbers from a file and find the minimum
// give an error message if the input file is empty

// THIS FILE NOT YET MODIFIED

#include <iostream>
#include <fstream>
using namespace std;

int main(void)
{
  
  ifstream infile ("nums.dat", ios::in);

  if (!infile)
    {
      cerr << "Could not open nums.dat, sorry!" << endl;
      exit (1);
    }
  
  // now read all nums from file
  // and find the sum

  int x;
  int sum=0;

  infile >> x;
  while (!infile.eof()) // while not end of file
    {
      sum += x;
      infile >> x;
    }
  
  cout << "sum: " << sum << endl;
  return 0;


}


