std::string name{}, go{};. The empty {} will initialize the variables to empty strings.std::getline(std::cin, name);. |
|
|
|
|
|
What you need to do is include the header file <string> then use std::string name{}, go{};. The empty {} will initialize the variables to empty strings. |
std::string is default initialised to an empty string with no further action required.std::string name; or simply string name; if you have the 'using namespace std;' declaration.