take string input with spaces in c++ code example
Example 1: how to make string get spaces c++
string s;
getline(cin,s);
Example 2: c++ reading string
#include <iostream>
#include <string>
string str;
getline(cin, str);
//str contains line
string s;
getline(cin,s);
#include <iostream>
#include <string>
string str;
getline(cin, str);
//str contains line