I have a bunch of files written in mostly one programming language and also some written in others. They are in different folders, but few and targetable.
I want to make a program that says how many lines of code there are. I know I could do this for one file, just like this:
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream f("file.txt");
int n = 0, aux;
string line;
while (getline(f, line))
n++;
cout << endl << n << " lines read" <<endl;
f.close();
}
But how could I "browse" all the files and folders and read them all? Having to do it explicitly for each one of them sounds awful to me.