I\'m trying to collect user\'s input in a string variable that accepts whitespaces for a specified amount of time.
Since the usual cin >> str does
You can directly use getline function in string using delimiter as follows:
#include
using namespace std;
int main()
{
string str;
getline(cin,str,'#');
getline(cin,str,'#');
}
you can input str as many times as you want but one condition applies here is you need to pass '#'(3rd argument) as delimiter i.e. string will accept input till '#' has been pressed regardless of newline character.