所以我有一个函数可以不断跳过第一个 getline 并直接跳到第二个。我试图清除缓冲区但仍然没有运气,这是怎么回事?
void getData(char* strA, char* strB)
{
cout << "Enter String 1: "; // Shows this line
cin.clear();
cin.getline(strA, 50); // 50 is the character limit, Skipping Input
cout << endl << "Enter String 2: "; // Showing This Line
cin.clear();
cin.getline(strB, 50); // Jumps Straight to this line
}