Answers for "input through getline in cpp"

C++
4

c++ reading string

#include <iostream>
#include <string>
string str;
getline(cin, str);
//str contains line
Posted by: Guest on January-26-2020
13

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

Browse Popular Code Answers by Language