All pastes #166474 Raw Edit

Untitled

public cpp v1 · immutable
·published 2006-09-10 22:55 UTC
rendered paste body
#include <iostream>#include <iomanip>#include <fstream>using namespace std;int main(){	// Declare variables to hold ticket data	int price, tickets, sales, x;	int totalsales = 0;	int totaltickets = 0;	// Declare file stream variables	ifstream fIn;	ofstream fOut;	// Open input/output files	fIn.open("F:\\ticket-sales\\tickets.txt");	fOut.open("F:\\ticket-sales\\output.txt");	// Grab input from the file	for (int x = 0; x < 4;) {		x++;		fIn >> price >> tickets;		sales = price * tickets;		totalsales += sales;		fOut << "Round: " << totalsales << endl;	}	// Set required output formatting	cout << fixed << showpoint << setprecision(2) << endl;	cout << "Writing data to file: 'output.txt'" << endl;		fOut << "Price: " << price << ", Tickets: " << tickets << ", Sales: " << sales << endl;	fOut << "Total Sales: $" << totalsales << endl;	fIn.close();	fOut.close();	return 0;}