print all file names in directory cpp
Sure, here is a response to your question:
#include <iostream>
#include <filesystem>
namespace fs = std::filesystem;
int main() {
for (const auto & entry : fs::directory_iterator("path_to_directory")) {
if (entry.path().extension() == ".cpp") {
std::cout << entry.path().filename() << std::endl;
}
}
return 0;
}