Hi!
I want to output the whole line with strings, not chars with the cin.get(name, 30); array. Can I do that with the #include <string> only?
Please don't use other includes since i have seen so many from the examples and they sometimes complicate things even more.
It worked only for the name, but not for the whole line
If i type in for example David Bright it will only show David
That is the whole point of using strings to get the whole name and surname
@mae
It worked for the full name. Even though i didn't exactly understood why:
1 2 3 4 5 6 7 8 9 10 11
// getline with strings
#include <iostream>
#include <string>
usingnamespace std;
int main () {
string str;
cout << "Please enter full name: ";
getline (cin,str);
cout << "Thank you, " << str << ".\n";
}