Answers for "cin.getline"

C++
12

get line C++

// 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;
}
Posted by: Guest on November-16-2019
1

cin.getline

string z,s;
 while (true)
    {
      cin>>z;
      s+=z;
      if(cin.peek()=='\n')
      break;
    }
................................
			OR\/
.................................
string s;
getline(cin,s);
Posted by: Guest on July-10-2021
1

cin.getline

cin>>n;
cin.ignore();
cin.getline(cin,string,'\n');
Posted by: Guest on September-28-2020
0

cin getline

getline(cin, variable_name);
Posted by: Guest on June-12-2021
0

getline vs cin.getline

getline(cin, variable_name, '\n');
Posted by: Guest on August-11-2020

Code answers related to "cin.getline"

Browse Popular Code Answers by Language