Try it like this?
cout << "Enter your name: ";
cin >> name;
cout << name << endl;
cout << "your name is: " << name << endl;
Here's how it looks on my end after compiling:
$ echo "foo" | ./a.out
Enter your name: foo
your name is: foo
Note:
Haven't used C++ in ages!