输入一个单词和一个句子,判断单词是否在句子中,请教各位这个程序有什么问题
# include<iostream.h>
# include<string.h>
bool FindFavorite( char[],char[]);
int main()
{
char phrase[80],word[15],answer[5];
bool Find_it;
do
{
cout<<"\n请输入你最喜欢的单词===>";
cin.getline(word,15);
cout<<"\n\n请输入一句换或者短语===>";
cin.getline (phrase,80);
Find_it= FindFavorite( phrase,word);
if( Find_it=true)
cout<<"\n找到了单词==>"<<word<<endl;
else
cout<<"\n未找到单词==>"<<endl;
cout<<"继续输入YES or NO";
cin.getline( answer, 5);
}
while(strcmp(answer,"yes")==0);
return 0;
}
bool FindFavorite(char phrase[],char word[])
{
bool result;
char *IsIthere;
IsIthere=strstr(phrase,word);
if (IsIthere==NULL)
result=false;
else
result=true;
return(result);
}