I have this code:
double i;
while(cin >> i)
{
if ( i < 0.0)
cout << "ENTER A POSITIVE NUMBER: ";
else
break;
}
I want code like this ( I don't want to use break):
while((cin >> i) < 0.0)
{
cout << "ENTER A POSITIVE NUMBER: ";
}
I get an error on this line: while((cin >> i) < 0.0) saying invalid operands to binary expression.
What am I missing?