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 print_directory(const string& str) {
- for (const auto& a : filesystem::directory_iterator(str)) {
- string name = a.path().filename().string();
- cout << setw(30) << name;
- string full_name = str + '/' + name;
- if (filesystem::is_regular_file(full_name)) {
- cout << '\t' << filesystem::file_size(full_name) << " bute";
- }
- cout << endl;
- }
- }
- int main() {
- SetConsoleCP(1251); // установка кодировки 1251 в поток ввода
- SetConsoleOutputCP(1251); // установка кодировки 1251 в поток вывода
- print_directory("C:/Users/PC/Desktop");
- }
Advertisement
Add Comment
Please, Sign In to add comment