#include <iostream>
using namespace std;
string userInput, userName;
The function below takes an input from the user
string takeInput()
{
cin.ignore();
getline(cin,userInput);
}
the takeInput() function would be called and its variable should be stored in the userName variable but nothing shows up when I run the program call the userName in the last cout.
int main() {
cout<<"Name: ";
userName = takeInput();
cout<<"My name is "<<userName;
}