// program to read 10 integers from "integer.file"
//             and 10 real numbers from "real.file"

#include <iostream.h>
#include <fstream.h>

void main (void)
{  ifstream inputfile[2];

   int i;
   float r;

   // read integer values from "integer.file"
   cout << "The integers from 'integer.file' follow:" << endl;
   inputfile[0].open ("integer.file");

   if (!inputfile[0].eof()) inputfile[0] >> i;
   while (!inputfile[0].eof()) /* continue until end of file found */
      { cout << i << endl;/* approach assumes <cr> follows value before <eof>*/
        inputfile[0] >> i;
      }

   inputfile[0].close () ;

   cout << "Integer file processed" << endl;

   // read real values from "real.file"
   cout << "The real numbers from 'real.file' follow:" << endl;

   inputfile[1].open ("real.file");

   inputfile[1] >> r;
   while (!inputfile[1].fail())          /* continue until reading fails */
      { cout << r << endl;
        inputfile[1] >> r;
      }

   inputfile[1].close () ;

   cout << "Real file processed" << endl;

}
