string with spaces in c++ code example
Example 1: store string with spaces c++
std::string str;
std::getline( std::cin, str);
Example 2: read string with spaces in c++
#include <string>
string s;
getline(cin, s);
std::string str;
std::getline( std::cin, str);
#include <string>
string s;
getline(cin, s);