1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
|
#include <iostream>
#include <string>
#include <fstream>
#include <iomanip>
using namespace std;
int main()
{
ifstream inputFile;
ofstream outputfile;
string album_Name,
artist_Name;
int count = 0;
double cost_Of_Album1,
cost_Of_Album2,
cost_Of_Album3,
cost_Of_Album4,
cost_Of_Album5,
total_Cost;
//Takes the values from file orders.txt to be brought onto the program.
inputFile.open("orders.txt");
outputfile.open("summary.txt");
cout << "Welcome to the Online Music store.\n";
cout << "You have submitted the following order: \n";
cout << setfill('*') << setw(70) << "*" << endl;
cout << setfill(' ');
cout << left << setw(5) << "Title" << right << setw(41) << "Artist" << setw(24) << "Cost" << endl;
getline(inputFile, album_Name);
getline(inputFile, artist_Name);
inputFile >> cost_Of_Album1;
cout << album_Name << setw(23) << artist_Name << setw(22) << cost_Of_Album1 << endl;
inputFile.ignore();
getline(inputFile, album_Name);
getline(inputFile, artist_Name);
inputFile >> cost_Of_Album2;
cout << album_Name << setw(28) << artist_Name << setw(19) << cost_Of_Album2 << endl;
inputFile.ignore();
getline(inputFile, album_Name);
getline(inputFile, artist_Name);
inputFile >> cost_Of_Album3;
cout << album_Name << setw(42) << artist_Name << setw(15) << cost_Of_Album3 << endl;
inputFile.ignore();
getline(inputFile, album_Name);
getline(inputFile, artist_Name);
inputFile >> cost_Of_Album4;
cout << album_Name << setw(19) << artist_Name << setw(15) << cost_Of_Album4 << endl;
inputFile.ignore();
getline(inputFile, album_Name);
getline(inputFile, artist_Name);
inputFile >> cost_Of_Album5;
cout << album_Name << setw(44) << right << artist_Name << setw(15) << cost_Of_Album5 << endl;
total_Cost = cost_Of_Album1 + cost_Of_Album2 + cost_Of_Album3 + cost_Of_Album4 + cost_Of_Album5;
cout << setfill('-') << setw(70) << "-" << endl;
cout << setfill(' ');
cout << "Total" << setw(65) << total_Cost << endl;
cout << setfill('=') << setw(70) << "=" << endl;
while (inputFile >> album_Name)
{
count++;
}
outputfile << "Downloads : " << count << endl;
outputfile << "Total Due: " << total_Cost << endl;
outputfile.close();
inputFile.close();
system("PAUSE");
return 0;
}
|