C++ : Checking if no Input is left to process

Revision en1, by scopeInfinity, 2016-12-29 17:41:09

There are few problems in which we can't determine length of input. Program is meant to process all the input it is given and terminates after no input is left in stdin.

For Example

Problem : Print Sum in new line for every two integer in a line.

Sample Input —

5 6
10 15
3 4

Sample Output -

11
25
7

Similar Question on SPOJ

http://www.spoj.com/problems/NHAY/

What is a good way to handle this kind of Inputs??

Tags c++, stdin, input

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English scopeInfinity 2016-12-29 17:54:39 11
en1 English scopeInfinity 2016-12-29 17:41:09 575 Initial revision (published)