// reading_and_writing_files.cpp

#include <iostream>
#include <fstream>
#include <cstdlib>
using namespace std;

int main()
{
	// *********** declaration statements *************
	int numBooks = 0;
	int numMovies = 0;
	double totalPrice = 0;
	int numOrders = 0;
	ifstream infile("C:/Users/PSU_USERNAME/Desktop/data.txt"); // or PSU_USERNAME.ACCESS.00?
	// fill in the asterisks with your PSU username

	// ************ input statements ******************
	while (!infile.eof())
	{
		infile >> numBooks; 
		totalPrice = totalPrice + numBooks * 9;
		
		infile >> numMovies;
		totalPrice = totalPrice + numMovies * 14;
		
		numOrders++;
	}

	ofstream outfile("C:/Users/PSU_USERNAME/Desktop/output.txt"); // or PSU_USERNAME.ACCESS.00?

	outfile << "The total price is " << totalPrice << " and there were " << numOrders << " orders." << endl;

	infile.close();
	outfile.close();

	system("pause");
	return 0;
}// end of main
