Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <iomanip>
- using namespace std;
- // Constants
- const int TITLE_LENGTH=35;
- const int EVENT_COUNT=11;
- const int CUSTOMER_AMOUNT=200;
- const int CUSTOMER_NAME=20;
- class EventInfo
- {
- private:
- char name[TITLE_LENGTH];
- int price;
- int places;
- int sold;
- int totalOrdered;
- int totalPaid;
- public:
- char* GetName(){return name;}
- int GetPrice(){return price;}
- int GetAmountSold(){return sold;}
- int GetAmountOrdered(){return totalOrdered;}
- int GetAmountPaidFor(){return totalPaid;}
- };
- class Customer
- {
- private:
- char CustomerName[CUSTOMER_NAME];
- int NumberOrdered[EVENT_COUNT];
- int NumberGotten[EVENT_COUNT];
- public:
- char* GetName(){return CustomerName;}
- int GetOrdered(int a){return NumberOrdered[a];}
- int GetGotten(int a){return NumberGotten[a];}
- };
- int main()
- {
- // ifstream inputFile("bil_olxx.res", ifstream::binary);
- // EventInfo events[EVENT_COUNT];
- //
- // for(int i = 0; i < EVENT_COUNT; i++)
- // inputFile.read((char*)&events[i], sizeof(EventInfo));
- // inputFile.close();
- //
- ifstream inputFile("kun_olxx.res", ifstream::binary);
- Customer Customerlist[CUSTOMER_AMOUNT];
- for(int i = 0; i < CUSTOMER_AMOUNT; i++)
- inputFile.read((char*)&Customerlist[i], sizeof(Customer));
- inputFile.close();
- for(int i = 0; i < CUSTOMER_AMOUNT; i++){
- for (int j=1; j<EVENT_COUNT;j++)
- cout << Customerlist[i].GetName() << ": " <<
- " " << Customerlist[i].GetOrdered(j) << "-" << Customerlist[i].GetGotten(j);
- cout << endl; }
- return 0;
- }
Add Comment
Please, Sign In to add comment