Link to home
Start Free TrialLog in
Avatar of Italbro2
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,struct std::char_traits<char>,class 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
ASKER CERTIFIED SOLUTION
Avatar of mnashadka
mnashadka

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Italbro2
Italbro2

ASKER

thk you
works good
I'm glad I could help.