Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <string>
- #include <clocale>
- using namespace std;
- int main()
- {
- setlocale(LC_ALL, "");
- int k = 0;
- string s;
- ifstream f;
- ofstream f1, f2;
- f1.open("C:\\SHP\\Парапапам\\2.txt");
- f2.open("C:\\SHP\\Парапапам\\3.txt");
- f.open("C:\\SHP\\Парапапам\\1.txt");
- while (!f.eof())
- {
- getline(f, s);
- cout << s << endl;
- for (int i = 0; i < s.size() - 2; i++)
- {
- if (s.at(i) == ' ' && s.at(i + 1) == ' ')
- {
- s.erase(i, 1);
- i--;
- }
- }
- if (s.at(s.size() - 1) == ' ')
- {
- s.erase(s.size() - 1, 1);
- }
- if (s.at(0) == ' ')
- {
- s.erase(0, 1);
- }
- cout << s;
- }
- f.close();
- f1.close();
- f2.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement