read "white spaces"

hi,

i write this code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <iostream>
using namespace std;

int main(){
		cout.unsetf(ios::skipws);
		cin.unsetf(ios::skipws);
		char name[80];

		cout << "What is your name: " ;
			cin >> name;

		cout << "\nYour name is: " << name << endl;			

		return 0;
}


and i run this program like that:

What is your name: Robert Manea
Your name is: Robert

why not "... Your name is: Robert Manea" ?
please help
http://www.cplusplus.com/reference/string/getline.html

Example: std::getline(std::cin,name); //name is an std::string
ok, thanks, its work ;)
Topic archived. No new replies allowed.