Just to be sure: 'cin' is a variable declared in the 'std' namespace and usually (or always, I don't really know but I don't think it's important) found in the iostream header file.
If I recall correctly, the specific use being given here is to check whether the input stream associated with this variable is good to go or not. In other words, that's the same as while (std::cin.good()). How is this possible? By means of an operator override. Something like:
I also think the condition is to exam the input is correct, but the while(std::cin) is in a main() funciton, there's no input operation except in the while, what's input does the while exam? the inside? how a a inside input stream go to while() ?
It allows the user to enter as many variable as they want as long as the cin is the type of the variable.
The loop will return false or break if the user enter a different type.
e.g.
1 2 3 4 5 6 7 8 9
int a;
string b;
cout<<" enter a\n";
while(cin>>a)
{
//keep doing this stuff
//if they enter b- stop this stuff
//i.e user's input cannot be converted to the type of the right hand operand of >>.
}
It just checks the input stream. The loop continues while the stream is in a good state. That is, while EOF has not been encountered and it's still open, ...
I would expect something to read from std::cin in the loop. But it's not common practice to write code like that.