Hi,
I am trying to write a C++ function that matches whether a string is present in a dictionary . It can be a partial string or a complete string. SO I read each and every line into a trie
trie< std::string, int > dict;
dict.insert(make_pair(line,i++));
// when i search for a string it always returns invalid.
if(dict.find("AA")!=dict.end())
cout<<valid<<endl;
else
cout<<invalid<<endl;
Can some one please help me with this. I added code for reading words in dictionary.
if(myfile.is_open())
{
int i=0;
string line;
cout<<dict.size()<<endl;
while(!myfile.eof())
{
getline(myfile,line);
dict.insert(make_pair(line,i++));
}
}