SOURCE FILE: 01_read_ints.cpp



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

/*

*/

int main ()
{
  char filename[256] ;

  cout << "Please type the name of a file: " ;
  cin >> filename ;

  ifstream fin ;
  fin.open(filename);
  if (fin.fail())
  {
    cout << "FAILED TO OPEN FILE: " << filename << endl ;
    exit(1) ;
  }

  int my_int ;
  
  for (int i=0; i<4; i++)
  {
     fin >> my_int ;
     cout << my_int << endl ;
  }
  
  fin.close() ;
  cout << endl ;

  cout << "\nAll Done!!\n\n" ;

  return 0 ;
}