I compiled and ran a sample code of getline
.
#include <iostream>
#include <string>
main ()
{
std::string name;
std::cout << "Please, enter your full name: ";
std::getline (std::cin,name);
std::cout << "Hello, " << name << "!\n";
return 0;
}
// from `http://www.cplusplus.com/reference/string/string/getline/`
I replaced std::getline
to getline
, but it still works. Why is it?