Mọi người cho em hỏi các lệnh cin.good(), cin.ignore(), cin.clear() ở trong chương trình này có ý nghĩa là gì vậy ạ? Em cảm ơn ạa
#include <iostream>
#include <stdlib.h>
using namespace std;
int main()
{
int ground;
cout << "The type of ground is: ";
cin >> ground;
cout << endl;
if (ground < 1 || ground > 999 || !cin.good())
{
cin.clear();
cin.ignore(1024, '\n');
cout << "Please enter the type of ground again!!" << endl;
}
system("PAUSE");
return 0;
}