Good day folks,
Can anyone tell me why my code only accept the first word of the input.
E.g., I input Ana mae.. The output will only consider Ana as my input hence it will produce like
Hello, Ana!
#include <iostream>
#include <string>
using namespace std;
int main()
{
string name;
cout << "Enter your name : " ;
cin >> name;
cout << endl;
const string greeting = "Hello, " + name + "!";
const string spaces(greeting.size(), ' ');
const string second = "* " + spaces + " *";
const string first(second.size(), '*');
cout << first << endl;
cout << second << endl;
cout << "* " + greeting + " *" << endl;
cout << second << endl;
cout << first << endl;
return 0;
}
It will disregard "mae" in the output