Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "pch.h"
- #include <iostream>
- #include <fstream>
- #include <locale>
- using namespace std;
- int main(){
- setlocale(LC_ALL, "Rus");
- char text[256];
- ifstream fin("text.txt");
- if (!fin) { cout << "Ошибка открытия файла." << endl; system("pause"); return 1; }
- while (!fin.eof())
- {
- fin.getline(text, 256);
- int len = strlen(text) - 1, h = len / 2;
- for (int i = 0; i < h; i++)
- {
- char temp = text[len - i];
- text[len - i] = text[i];
- text[i] = temp;
- }
- cout << text << endl;
- }
- fin.close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement