The manager of a football stadium wants you to write a program that calculates the total ticket sales after each game. There are four types of tickets--box, sideline, premium, and general admission. After each game, data is stored in a file in the following form:
ticketPrice numberOfTicketsSold
...
Sample data are shown below:
250 5750
100 28000
50 35750
25 18750
The first line indicates that the ticket price is $250 and that 5750 tickets were sold at that price. Output the number of tickets sold and the total sale amount. Format your output with two decimal places.
good luck!
Additional Details
/*
*/
// program to claculate total tickets sold and total gross ammount
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;
int main()
{
//declare variables
ifstream inFile;
int ticketPrice;
int noOfTicketSold;
inFile.open("c:\\Dev-Cpp\\inFile.txt");
cout << fixed << showpoint;
cout << setprecision(2);
cout << "Processing data" << endl;
while( inFile >> ticketPrice >> noOfTicketSold);
{
cout << "Number of tickets sold : " << noOfTicketSold << endl;
cout << "Total sale ammount : " << ticketPrice * noOfTicketSold << endl;}
inFile.close();
return 0;
}
that is my code but it si not working i tried but failed miserably :-(
my result comes out as number of tickets sold : 2
total sale ammount :179022898