getline in c++

C++
// C++ program to demonstrate getline() function 
  
#include <iostream> 
#include <string> 
using namespace std; 
  
int main() 
{ 
    string str; 
  
    cout << "Please enter your name: \n"; 
    getline(cin, str); 
    cout << "Hello, " << str 
         << " welcome to GfG !\n"; 
  
    return 0; 
} 
//getline definition
istream& getline (istream& is, string& str, char delim);
// extract to string
#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;
}#include <iostream>
#include <string>
string str;
getline(cin, str);
//str contains line
Source

Also in C++: