Answer:
The following will be used:
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;
int main() {
double total = 0;
int nTickets = 0;
ifstream infile("tickets.txt");
ofstream outfile("output.txt");
int a,b;
while (infile >> a >> b)
{
total += a*b;
nTickets = nTickets + b;
}
outfile << "Total Sale amount: " << setprecision(2) << total << endl;
outfile << "Number of tickets sold: " << nTickets << endl;
outfile.close();
cout<<"See output file: output.txt for the results."<<endl;
return 0;
}