Advertisement
Guest User

Untitled

a guest
Oct 21st, 2014
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. //Mark McAfee
  2. //Program calculates the total sales after each game
  3.  
  4. #include <iostream>
  5. #include <fstream>
  6. #include <iomanip>
  7.  
  8. using namespace std;
  9.  
  10. int main(){
  11.     //declare variablesifstream inFile;
  12.  
  13.     int ticketPrice; int noOfTicketSold;
  14.     inFile.open("c:\\C++\\sales.txt");
  15.     cout << setprecision(2);
  16.     cout << fixed << showpoint;
  17.  
  18.     cout << "Processing data" << endl;
  19.  
  20.     while (inFile >> ticketPrice >> noOfTicketSold){
  21.         cout << "Number of tickets sold : " << noOfTicketSold << endl;
  22.         cout << "Total sale ammount : " << ticketPrice * noOfTicketSold << endl;
  23.     }
  24.     inFile.close();
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement