Reputation: 5300
I was trying to read a lot of numbers dynamically using the code below followed by EOF
at the end:
vector<double> data;
double x;
while (cin >> x)
{
data.pushback(x);
}
this method is working great but i would like to know what is happening with the expression below
cin >> x
Yeah, I know that it is used to input the data but how come I'm able to test conditions with it.
What happens with the expression below:
while (cin) or if (cin)
What does cin
return?
Upvotes: 0
Views: 343