MaksNew

Untitled

Jan 23rd, 2021
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.92 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <filesystem>
  4. #include <sstream>
  5. #include <string>
  6. #include <set>
  7. #include <iomanip>
  8. #include <Windows.h>
  9. #ifdef max
  10. #undef max
  11. #endif
  12. using namespace std;
  13. int main()
  14. {
  15.     SetConsoleCP(1251);
  16.     SetConsoleOutputCP(1251);
  17.     setlocale(LC_ALL, "ru");
  18.     worker demo("вован", 1, 2, 3, 4, 5, 6);
  19.     string path = "C:\\Users\\Max\\Desktop\\JAVAFILE.txt";
  20.  
  21.     ofstream fout;
  22.     fout.open(path, ios_base::trunc);
  23.  
  24.     fout.write((char*)&demo, sizeof(worker));
  25.  
  26.     fout.close();
  27.  
  28.     worker buf;
  29.     ifstream fin;
  30.     fin.open(path);
  31.     while (fin.read((char*)&buf, sizeof(worker)))
  32.     {
  33.         cout << buf.name << " " << buf.detailsOnMonday << " " << buf.detailsInTuesday << " " << buf.detailsInWednesday << " " << buf.detailsInThursday << " " << buf.detailsOnFriday << " " << buf.detailsOnSaturday << endl;
  34.     }
  35.     fin.close();
  36.     //showMenu();
  37. }
  38.  
Advertisement
Add Comment
Please, Sign In to add comment