Well i allways do it like this.
#include <iostream>
using namespace std;


int main()
{
char first_name[64];
char last_name[64];

cout << "Type your first and last name: ";
cin.getline(first_name, 64, '\n');

cin.getline(last_name, 64, '\n');
cout << "Hey, " << first_name << " " << last_name;

return 0;
}