Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <string>
- #include <Windows.h>
- using namespace std;
- int main() {
- SetConsoleCP(1251);
- SetConsoleOutputCP(1251);
- ifstream fin;
- fin.open("C:/Users/PC/Desktop/file.txt");
- ofstream fout;
- fout.open("C:/Users/PC/Desktop/file2.txt");
- if (!fin.is_open() || !fout.is_open()) {
- cout << "Ошибка открытия файла" << endl;
- }
- else {
- char ch;
- while (fin.get(ch)) {
- if (ch >= 'А' && ch <= 'Я') {
- ch += 32;
- }
- fout << ch;
- }
- fin.close();
- fout.close();
- remove("C:/Users/PC/Desktop/file.txt"); // удаляем старый файл
- rename("C:/Users/PC/Desktop/file2.txt", "C:/Users/PC/Desktop/file.txt"); // переименовываем новый файл (называем его именем старого)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment