c++ getline()

#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;
}

输出:

  Please, enter your full name: kilen

  Hello, kilen!

posted @ 2017-04-24 12:11  kilen  阅读(96)  评论(0编辑  收藏  举报