我正在尝试编写一个while循环,当我选择actres或电影标题时,它存在while循环.但由于某种原因,它不能告诉我,行中有错误while (selecton).有人有想法吗?
string selection;
while ( selection )
{
cin >> selection;
if ( selection == "actress" )
{
cout << "hey" << endl;
break;
}
else if ( selection == "movie title" )
{
cout << "bye";
break;
}
else
{
cout << "Please choose a selection";
}
}
Run Code Online (Sandbox Code Playgroud)