lundi 23 avril 2018

Explanation of a code segment

this is my first post on stack overflow.

I write a code in C ++ and with a function I need an input in which the numbers are entered. I have found a code segment on the internet that does this but has no idea how it works. Can someone please explain to me how this code works?

while(!(cin >> control))
{
     cin.clear(); 
     cin.ignore(numeric_limits<streamsize>::max(), '\n'); 
     cout << "Invalid input.  Try again: ";
} 

Aucun commentaire:

Enregistrer un commentaire