// simple basic file input-output structure

 

#include <iostream.h>

#include <fstream.h>  // for file IO

 

int main()

{

 

// declare variables, etc.

// declare variables, etc.

// declare variables, etc.

// declare variables, etc.

 

 

 

//---------------------------------------------------

// Declare input and output variables once per program

ifstream inData;    // variable collecting the input

ofstream outANSWER; // variable collecting the output

 

// Open the input and output files in same folder as “.cpp

inDATA.open("inputfile.txt");     // where to get the input

outANSWER.open("outputfile.txt"); // where to put the output

//---------------------------------------------------

 

 

// Now use inDATA and outANSWER instead of cin and cout

 

// Read in some data

inDATA >> variable1 >> variable2 >> variable3;

 

//formulas, etc.

//formulas, etc.

//formulas, etc.

//formulas, etc.

//formulas, etc.

 

// Output results

outANSWER << "Results are: " << variable4 <<  " and " << variable5;

 

return 0;

}