指定された時間、空白を受け入れる文字列変数でユーザーの入力を収集しようとしています。
通常cin >> str
は空白を受け入れないため、 std::getline from <string> を使用します
これが私のコードです:
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
int main()
{
int n;
cin >> n;
for(int i = 0; i < n; i++)
{
string local;
getline(cin, local); // This simply does not work. Just skipped without a reason.
//............................
}
//............................
return 0;
}
何か案が?