string get full cin

Solutions on MaxInterview for string get full cin by the best coders in the world

showing results for - "string get full cin"
Heidi
27 Feb 2016
1// use std::getline( std::cin, your string ), from <string>
2// extract to string
3#include <iostream>
4#include <string>
5
6int main ()
7{
8  std::string name;
9
10  std::cout << "Please, enter your full name: ";
11  std::getline (std::cin,name);
12  std::cout << "Hello, " << name << "!\n";
13
14  return 0;
15}