Input of Unkown Size
I am solving problem, where I need to perform the same operation of an unknown number of test cases.
Input:
Output:
My problem is I do not know how to know when to stop reading input.
So what's the problem?
1 2 3 4 5 6 7 8 9
|
void foo( std::istream& stm )
{
int a, b ;
while( stm >> a >> b )
{
// process iniput a, b
std::cout << a*b << '\n' ;
}
}
|
Thank You. Line 4 really helped.
Topic archived. No new replies allowed.