Answers for "c++ take input line"

C++
17

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
0

input full line as input in cpp

string line;

while (getline(cin, line)) {
    // do something with the line
}
Posted by: Guest on December-29-2021

Code answers related to "c++ take input line"

Browse Popular Code Answers by Language