Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- #include <iostream>
- #include <string>
- #include <fstream>
- #include <filesystem>
- #include <windows.h>
- using namespace std;
- void find_all(const string& find_name, const string& catalogue) {
- for (const auto& a : filesystem::directory_iterator(catalogue)) {
- string name = a.path().filename().string();
- string full_name = catalogue + '/' + name;
- if (name.find(find_name) != string::npos) {
- cout << full_name << endl;
- }
- if (filesystem::is_directory(full_name)) {
- find_all(find_name, full_name);
- }
- }
- }
- int main() {
- SetConsoleCP(1251); // установка кодировки 1251 в поток ввода
- SetConsoleOutputCP(1251); // установка кодировки 1251 в поток вывода
- find_all("Задания", "C:/Users/PC/Desktop/Основы программирования С++");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement