为什么不能连续输入?
那位高手帮改一下,使第二次输入都能正常读入value中。
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
int main()
{
string st ;
vector<string> text;
cout << "Enter the text:" << endl;
while(cin >> st)
{ text.push_back(st); }
int cnt ;
string value;
cout << "Enter the value:";
cin >> value; //输入出现问题,如何解决?
cnt = count(text.begin(), text.end(),value);
cout << "cnt = " << cnt << endl;
system("pause");
}