cin.getline

hi any ideas why I get error on line 3?
Thanks!

1
2
3
4
5
  string name;
	cout<<"What is your name: ";
	cin.getline(name);
	cout<<endl << "your name is '" << name << "'\n";
	cout<<"It is " << name.size() << " letters long\n";
try the syntax getline(cin, name);
As dub1987 said, you need std::getline(std::cin, name). istream::getline() works only with C-strings
many thanks!!!
Topic archived. No new replies allowed.