string array getline
Posted on 2004-11-10
I'm puzzled by a statement(s) regard getline and after perusing the standard I'm in need of clarification. Consider.
cout << "Please enter your name: ";
cout << "Hello " << myName << endl;
The program has an obvious errror so the programmer was told:
"getline doesn't accept a string array for its second parameter. Just get rid of the  from myName."
Now I question the validity of said statement in part because 'getline' can and DOES accept a string array as its second parameter. So now:
std::cout << "Enter some words...\n";
std::cout << "Enter something else...\n";
std::cout << "You entered:\n";
for(int i(0); i< 2; ++i)
std::cout << Array[i] << std::endl;