“cin.getline” Kode Jawaban

Dapatkan baris 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;
}
Collared Lemming

cin.getline

cin>>n;
cin.ignore();
cin.getline(cin,string,'\n');
Exuberant Eel

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya