// Program iodemo demonstrates how to use files.

// Begin with preprocessor directives and using statements

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

// Define the global function main()

int main()
{
	float val1, val2, val3, val4;	// declare 4 float variables
	ifstream inData;				// declare input stream
	ofstream outData;				// declare output stream
	
	// Set up formatting for output object outData
	
	outData.setf(ios::fixed, ios::floatfield);
	outData.setf(ios::showpoint);
	
	// Open the input file and associate with the inData object
	
	inData.open("indata.txt");
	
	// Open the (initially empty) output file and associate it with the
	// outData object
	
	outData.open("outdata.txt");
	
	// Read in the four values from the input stream
	
	inData >> val1 >> val2 >> val3 >> val4;  // These could be separate stmts
	
	// Manipulate and output values to the output stream
	
	outData << val4 * 4 << endl;
	outData << val3 * 3 << endl;
	outData << val2 * 2 << endl;
	outData << val1 << endl;
	
	return 0;
}

