I want to read a string, the string can contain spaces.
I tried:
char* str;
cin >> str; // but I have to allocate a memory by making new
so I think about:
string str;
cin >> str;
but it reads until the first space.
can someone know how can I get it? maybe getline
?
I can use only the includes of iostream
and string
.