#include
std::string input;
std::cin >> input;
The user wants to enter \"Hello World\". But cin
fails at the spa
I rather use the following method to get the input:
#include
#include
using namespace std;
int main(void) {
string name;
cout << "Hello, Input your name please: ";
getline(cin, name);
return 0;
}
It's actually super easy to use rather than defining the total length of array for a string which contains a space character.