-
scanf
how would i be able to read in two numbers at a time from input with scanf?
i tried scanf( "%d %d", &x &y ) but it doesnt work like how i want it to.
i want to read in like:
100 22
23 33
44 55
so the first row of numbers would be equivalent to one group.
-
sorry
while ( scanf( "%d %d", &x, &y ) == 1 )
so i want to end it with a crtl-D
-
>>while ( scanf( "%d %d", &x, &y ) == 1 )
scanf() returns the number of successfully read variables, so in your example the desired return code is 2, not 1.
>>while ( scanf( "%d %d", &x, &y ) == 2 )