I'm using multiple getline(cin, string)
calls to get two strings; however the code is skipping the second call and only handling the first.
for (int i = 0; i < 2; ++i)
{
if (i == 0)
{
cout << "Please enter string A: " << endl;
getline(cin, stringA);
}
if (i == 1)
{
cout << "Please enter string B: " << endl;
cin.ignore();
getline(cin, stringB);
}
}
How do I change this to handle multiple getline() calls?