What does this cin.clear() and cin.ignore() means?
this is the part of the code :
while(1) {
cout<<"Enter the Product ID :";
cin>>product[i].id;
cout<<endl;
if(cin.fail())
{
cout << "\t\t\t\t\WRONG ID DATA!" << endl;
cin.clear(); //what does it means??
cin.ignore(1000, '\n'); //why 1000??
continue;
}
break;
}
thank you for helping....