Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <windows.h>
- #include <fstream>
- #include <string>
- #include <vector>
- #include <algorithm>
- #include <cctype>
- using namespace std;
- int main()
- {
- SetConsoleCP(1251);
- SetConsoleOutputCP(1251);
- setlocale(LC_ALL, "rus");
- system("color 0A");
- cout << "Введите полное имя файла (путь + имя)" << endl;
- string s;
- getline(cin, s);
- ifstream fin(s);
- size_t del = 0u;
- for (size_t u = 0u; u < s.size(); ++u)
- {
- if (s[u] == '\\')
- {
- del = u;
- }
- }
- s.erase(s.begin() + del + 1u, s.end());
- vector<string> box;
- for (;fin.good();)
- {
- string str;
- fin >> str;
- box.push_back(str);
- }
- fin.close();
- vector<string> box2;
- for (const auto &str : box)
- {
- string rez;
- for (const auto &c : str)
- {
- auto cc = static_cast<unsigned char>(c);
- if (toupper(cc) == cc)
- {
- rez.push_back(tolower(cc));
- }
- else
- {
- rez.push_back(toupper(cc));
- }
- }
- box2.push_back(rez);
- }
- ofstream fout(s + "output.txt");
- for (const auto &str : box2)
- {
- fout << str << endl;
- }
- fout.close();
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement