Italbro2
asked on
C++ cannot convert parameter 1 : Function Problem... (urgent )
Hi
here is my code :
in my main() :
string TypeWord ;
int plen ;
cin >> TypeWord;
plen = TypeWord.length();
cout << plen;
if (VerifyWord(TypeWord,plen) ) // here is my mistake
{
cout << TypeWord << " is in tree ";
}
else {
cout << TypeWord << "is not in tree." ;
}
here is my function VerifyWord :
bool VerifyWord(const char * word, int len)
{
int plen;
Dictio * n = root -> follow(word,len,plen);
return (plen == len && n -> IsFullWord());
}
here is my error :
'VerifyWord' : cannot convert parameter 1 from 'class std::basic_string<char,str uct std::char_traits<char>,cla ss std::allocator<char> >' to 'const char *'
i know i wont convert cause its not the same but i cant make it work
i type a word and i check if its in my tree.
how can i make my CIN<< TypeWord ... word
need an answer
here is my code :
in my main() :
string TypeWord ;
int plen ;
cin >> TypeWord;
plen = TypeWord.length();
cout << plen;
if (VerifyWord(TypeWord,plen)
{
cout << TypeWord << " is in tree ";
}
else {
cout << TypeWord << "is not in tree." ;
}
here is my function VerifyWord :
bool VerifyWord(const char * word, int len)
{
int plen;
Dictio * n = root -> follow(word,len,plen);
return (plen == len && n -> IsFullWord());
}
here is my error :
'VerifyWord' : cannot convert parameter 1 from 'class std::basic_string<char,str
i know i wont convert cause its not the same but i cant make it work
i type a word and i check if its in my tree.
how can i make my CIN<< TypeWord ... word
need an answer
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I'm glad I could help.
ASKER
works good