I want to read a Source Code file and separate the lexemes (words) and want to track the line number with the separated words?
I just come up with the raw code like that...
i) A struct holding a string , int pair;
ii) making the link list of above struct
for example
class Container {
struct Words{
string word;
int lineNo;
};
//
vector<Words> vWord;
int& operator[](string const& Value); //use to get the line number corresponds to given value;
};
please tell me is there any optimal solution than this.........