Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Lab01-SalesRecipts.cpp : Shows Recipts of customers sales
- //
- #include <iostream>
- #include <fstream>
- #include <string>
- #include <iomanip>
- using namespace std;
- int main()
- {
- string lastname;
- string firstname;
- char code;
- int price;
- int quantity;
- int itemtotal;
- int grandtotal;
- int recordCnt = 0;
- int processes = 0;
- ifstream SalesRecipts;
- SalesRecipts.open("SalesRecipts.txt");
- if (!SalesRecipts)
- {
- cout << endl << "Error opening input file." << endl << endl;
- system("pause");
- return -1;
- }
- cout << fixed << setprecision(2);
- SalesRecipts >> code;
- SalesRecipts >> lastname >> firstname >> code >> price >> quantity;
- itemtotal = quantity * price;
- while (!SalesRecipts.eof());
- {
- recordCnt++;
- cout << code;
- cout << quantity << " @ " << price << itemtotal;
- cout << lastname << ". " << firstname << endl;
- }
- SalesRecipts.close();
- cout << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement