I'm confused about the use of #include <string>
directive, I know it should be used before any string is included, also too the global function getline()
, but how when do I build and execute the following program it doesn't gave back any errors when I not included #include <string>
directive
#include <iostream>
using namespace std;
int main()
{
string theName;
cout << "Enter the name: ";
getline(cin, theName);
cout << "The name is " << theName << endl;
return 0;
}