使ってます
getline(cin , inputStr); // where string = inputStr;
文字列型のユーザーから入力を受け取ります。コードは完全に機能していました。しかし、今、どういうわけか、whileループでは、それは呼び出されていません。つまり、コンパイラはこの部分をスキップしているようです。
しかし、cin >> str
単独でも問題なく動作します。助言がありますか?
コメントからのコード:
int num, choice;
string inputStr="";
while(1)
{
cout<<"1) Search \n";
cout<<" EXIT\n";
cout<<"Choose your choice : ";
cin >> choice;
switch(choice)
{
case 1:
cout<<"word for search\n";
getline(cin, str);
cout<< str <<endl;
return 0;
//just checking whether this commands work or not.
}
else
{
return 0;
}
.......// there is 300 lines of code still there