Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "iostream"
- #include "fstream"
- #include "string"
- using namespace std;
- int main()
- {
- ifstream in("f12345.txt");
- ofstream out("g12345.txt");
- string s;
- //записываем в строку s все символы из файла f12345.txt
- while (in.peek() != EOF)
- {
- char a; in.get(a);
- s += a;
- }
- //переворачиваем строку s
- for (int i = 0; i < s.length() / 2; ++i)
- {
- char a = s[i];
- s[i] = s[s.length() - 1 - i];
- s[s.length() - 1 - i] = a;
- }
- out << s << endl;
- in.close();
- out.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement