35657

Untitled

Aug 24th, 2024
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.84 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS
  2.  
  3. #include <iostream>
  4. #include <string>
  5. #include <fstream>
  6. #include <filesystem>
  7. #include <windows.h>
  8.  
  9. using namespace std;
  10.  
  11. void find_all(const string& find_name, const string& catalogue) {
  12.     for (const auto& a : filesystem::directory_iterator(catalogue)) {
  13.         string name = a.path().filename().string();
  14.         string full_name = catalogue + '/' + name;
  15.         if (name.find(find_name) != string::npos) {
  16.             cout << full_name << endl;
  17.         }
  18.         if (filesystem::is_directory(full_name)) {
  19.             find_all(find_name, full_name);
  20.         }
  21.     }
  22. }
  23.  
  24.  
  25.  
  26. int main() {
  27.  
  28.     SetConsoleCP(1251); // установка кодировки 1251 в поток ввода
  29.     SetConsoleOutputCP(1251); // установка кодировки 1251 в поток вывода
  30.  
  31.     find_all("Задания", "C:/Users/PC/Desktop/ООП С++");
  32.  
  33. }
  34.  
Advertisement
Add Comment
Please, Sign In to add comment