why the "getline" command does not get recognized by VS?

Viewed 11

The word "getline" is a red and underlined, which indicate an error:

#include <iostream>
using namespace std;

string ReadName()
{
    string Name;
    cout << "Please Enter Your Name: " << endl;
    getline(cin, Name);
    return Name;
}

void PrintName(string Name)
{
    cout << "\nYour name is " << Name << endl;
}
int main()
{
    PrintName(ReadName());
    return 0;
}

The VS Gives an error regarding getline

0 Answers
Related