Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void readTransaction(Transaction &transaction, ifstream &trans, vector <string> &Products, int &clientID)
- {
- // file transactions:
- if (trans.is_open())
- {
- string line;
- for (int counter = 1; getline(trans, line, ';'); counter++)
- {
- //cout << line << endl; show: 1/01/2016 ...
- stringstream ss(line);
- string test;
- switch (counter)
- {
- case 1:
- //cin >> transation.id; //cli
- ss >> transaction.id;
- if (transaction.id > clientID)
- clientID = transaction.id;
- break;
- case 2:
- /*int i;
- i << ss; // mandar de ler de um ss para um int */
- getline(ss, test, '/');
- cout << test << endl;
- getline(ss, test, '/');
- cout << test << endl;
- getline(ss, test, '/');
- cout << test << endl;
- //cin >> transation.buyDate.day; // read the day of shopping
- /*
- getline(ss, line, '/');
- cin >> transation.buyDate.month;
- getline(trans, line, '/');
- cin >> transation.buyDate.year;*/
- /*switch (int counter = 0 )
- case 1:*/
- break;
- case 3:
- /*istringstream lineI(line); // read until the end of line
- while (getline(trans, line)); coloca para um string os items
- getline(trans, line, ',');
- push_back
- while (!items.eof())
- cin >> transation.Items;
- counter++;
- if (counter > 3)
- {
- counter = 1;
- Products.push_back(transation);
- }*/
- counter = 1;
- break;
- }
- }
- }
- else
- cerr << "error to open transactions file" << endl;
- /*while (!cli.eof()) // if
- {
- // c_str . atoi (process clients
- // .push_back
- }*/
- }
Advertisement
Add Comment
Please, Sign In to add comment