x2311

Untitled

May 2nd, 2022
1,025
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <string>
  4. #include <algorithm>
  5.  
  6. using namespace std;
  7.  
  8. int main() {
  9.     ifstream file;
  10.     file.open("..\\tess.txt");
  11.     //error checking
  12.     if (!file.is_open()) {
  13.         cout << "ERROR\n\n";
  14.         return 1;
  15.     }
  16.  
  17.     string str; //читаю строку
  18.     int rez = 0; //результат
  19.     while (getline(file, str)) {
  20.         reverse(str.begin(), str.end());
  21.         cout << str <<endl;
  22.     }
  23.  
  24.     file.close();
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment