// Demonstrates the use of "fstream"
// Reads in an integer n (<=100) , and then n floating-pt numbers, from a
// file called "input.dat".  Writes the n numbers out in file "output.dat",
// one to a line

#include <fstream>
#define nMax 100

//declaring file variables
ifstream inFile;
ofstream outFile;

int n;
float F[nMax];

void main()
{

  //opening the files
  inFile.open("input.dat", ios::in);
  outFile.open("output.dat", ios::out); // could also be "ios::app"

  inFile >> n;

  for (int i=0; i<n; i++) inFile >> F[i];

  for (int i=0; i<n; i++) outFile << F[i] <<endl;
  
  //closing the files

  inFile.close();
  outFile.close();
}
