I am writing a program that takes input from the user. I need the input to include spaces between the words. I am having trouble finding a solution to do that.
Before you ask, I have tried multiple other questions on StackOverflow with the same question. These are some of the ones I have tried:
Demonstration of noskipws in C++
The problem with my code is that as soon as my setBusinessName()
method is called, it just completes itself. It outputs and then returns itself without waiting for me to input my data.
string setBusinessName()
{
string name = "";
cout << "The name you desire for your business:";
getline(cin, name, '\n');
cout << name;
return name;
}