I just found a function that one of my former professors made for us to use in class and I did not understand a line and what it does. I haven't had this professor for several semesters so I can't ask him. What does line 14 do?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
void getChar(char& charInput)
{
string input;
string::size_type len;
while (true)
{
getline(cin, input);
len = input.length();
if (len != 1)
cout << "Please enter a valid character as your response ==> ";
else
{
charInput = input[0];
return;
}
}
return;
}