运行此代码时出现奇怪的结果
void MovieDatabase:: showMovie(const string mtitle){
cout << "The informations about the" << mtitle << endl;
for(Movie* cur = headMovie; cur ->next !=NULL; cur= cur->next){
if(cur -> title == mtitle){
cout <<"Movie title is "<< cur ->title << endl;
//cout < "The name of director is " << cur -> firstNameOfDirector << endl;
cout << "The last name of director is " << cur -> lastNameOfDirector <<endl;
cout << "The year that the movie is released " << cur -> year << endl;
cout << "The day that the movie is released " << cur -> day << endl;
cout << "The month that the movie is released " << cur -> month << endl;
}
}
cout << endl;
}
这是我正在检查电影标题的代码,如果它们在链接列表中,我正在打印有关电影的详细信息。但是,作为输出,它只打印以下行
cout << "The informations about the" << mtitle << endl;`
我不明白是什么原因有人可以帮忙吗?