Advertisement
Maksud3

GetShoppingHistory

May 16th, 2019
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. void User::GetShoppingHistory()
  2. {
  3.     ifstream output;
  4.     string path = "Users\\";
  5.     string buffer;
  6.     string file;
  7.     int Counter = 0;
  8.     path += this->GetLogin() + "History" + ".txt";
  9.  
  10.     output.open(path, ios::in);
  11.  
  12.     if (output.is_open())
  13.     {
  14.         while (!(output.eof()))
  15.         {
  16.             output >> file;
  17.             buffer += file + " ";
  18.             Counter++;
  19.             if (Counter % 16 == 0)
  20.             {
  21.                 cout << buffer << endl;
  22.                 buffer = "";
  23.             }
  24.         }
  25.     }
  26.     else
  27.     {
  28.         cout << "This user has no the purchase history!" << endl;
  29.     }
  30.  
  31.     output.close();
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement