Hello!
I am compiling in VS, when I type a compose name, for example, "Davis Jones", only the first name is inputted, looks like that spaces between words do not work. Could someone help me to understand my mistake?
1 2 3 4 5 6 7 8 9
#include <iostream>
int main() {
std::string a;
std::cout << "\Please enter a compose name: " << std::endl;
std::cin >> a;
std::cout << "\You entered: " << a << std::endl;
}
Notice that the istream extraction operations use whitespaces as separators; Therefore, this operation will only extract what can be considered a word from the stream. To extract entire lines of text, see the string overload of global function getline.