<分区>
#include <iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
vector<string>Games;
vector<string>::iterator iter;
string command;
string name;
cin>>command;
if(command=="add"){
cout<<"You have choosen to add a game to your backlog.\n";
cout<<"Enter the name of the Video Game\n";
getline(cin,name);
Games.push_back(name);
cout<<"The Game has been added\n";
}
是的,我知道这已存档。而且我知道你应该使用 getline() 函数将 cin 和字符串的名称传递给函数来保存字符,但是当我在键入“添加”命令后编译并运行它时,然后该行 getline(cin,name) 被跳过,我无法输入任何内容。