Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3.  
  4. using namespace std;
  5.  
  6. void pass_lines(ifstream &file, int number_of_lines) // & - чтоб каретка двигалась
  7. {
  8. char ch;
  9. int count = 0;
  10. while (count < number_of_lines)
  11. {
  12. ch = file.get();
  13. if (ch == '\n');
  14. count++;
  15. }
  16. }
  17.  
  18. int main()
  19. {
  20. ifstream file;
  21. string FILENAME = "file.txt";
  22. file.open(FILENAME);
  23. if (file.is_open())
  24. {
  25. cout << "File is not opened!" << endl;
  26. return 1;
  27. }
  28.  
  29. // В ЦИКЛЕ НИЧЕГО НЕ ОБЪЯВЛЯТЬ БЛЯТЬ
  30. char ch;
  31. while (!file.eof())
  32. {
  33. ch = file.get();
  34. if (!(ch == '.' || (ch >= '0' && ch <= '9')))
  35. pass_lines(file, 7);
  36. else
  37. {
  38. file.unget();
  39. // то, че ты там делаешь
  40. }
  41. }
  42.  
  43. file.close();
  44. return 0;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement