using getline code example
Example 1: getline cpp
#include <iostream>
#include <string>
int main()
{
string namePerson{};
getline(cin, namePerson);
std::cout << namePerson;
}
Example 2: get line C++
#include <iostream>
#include <string>
int main ()
{
std::string name;
std::cout << "Please, enter your full name: ";
std::getline (std::cin,name);
std::cout << "Hello, " << name << "!\n";
return 0;
}
Example 3: how to use getline function inc
size_t getline(char **lineptr, size_t *n, FILE *stream);Copy