how to make string get spaces c++

C++
string s;
getline(cin,s);
Source

Also in C++: