template < class T>
T inputData (T fName, T lName)
{
cout << "Please input your first name: ";
cin >> fName;
cin.ignore();
cout << "Please input your Last name: ";
cin >> lName;
cin.ignore();
return (fName + lName);
}
int main ()
{
string fName;
string lName;
cout << inputData(fName[0], lName[0]);
return 0;
}
I am trying to display the first letter of the first and last name next to one another. However whenever I run this it tries to input the last name as a data type.