unresolved overload function

Looking for some help - I am sure the problem is right in front of me, but I keep missing it. Can you help me find the error in line 7

#include<iostream>
using namespace std;
int main()
{
char name[20], go;
cout << "Enter your name: ";
cin.getline > (name,20);
cout << "Hi " << name << endl;
cout << "Press the ENTER key to end this program.";
cin >> go;
return 0;
}
change it to : cin.getline( name,20 );

btw, as u can see, characters are limited to 20, if u want to be able to store greater than that, u have to increase the array size, if you want to store arbitrary length of string, you
can use std::string instead :

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

int main()
{
  string name, go;

  cout << "Enter your name : ";
  getline( cin, name ); // this form of getline should be used for string

  // ...
}
Last edited on
Topic archived. No new replies allowed.