Advertisement
Guest User

Untitled

a guest
May 4th, 2016
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.68 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <fstream>
  4. #include <locale>
  5. #include <windows.h>
  6.  
  7. using namespace std;
  8.  
  9. struct
  10. {
  11. string filename;
  12. ifstream file;
  13. unsigned int struct_cnt = 0;
  14. COORD pos;
  15. }ftool;
  16.  
  17. struct Book
  18. {
  19. string author;
  20. string name;
  21. int year;
  22. };
  23.  
  24. int main()
  25. {
  26. setlocale(LC_ALL, "Russian");
  27. cout<<"Введите имя файла:"<<endl;
  28. getline(cin, ftool.filename);
  29. ftool.file.open(ftool.filename.c_str(), ios_base::in);
  30. char buff;
  31. do
  32.    {
  33.    ftool.file>>buff;
  34.    if(buff=='~'){ftool.struct_cnt++;}
  35.    }while(!ftool.file.eof() && ftool.struct_cnt<20);
  36. ftool.file.seekg(0);
  37. do
  38.    {
  39.    ftool.file>>buff;
  40.    }while(!ftool.file.eof());
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement