Being a bit controversial here, the problem is one of those problems that if you followed the pseudocode given above you'd end up with a solution that's not really idiomatic in C++, it'd look like a clumsily ported C# or Java solution.
So given the C++ I/O entity is a stream, the solution looks more like:
extract number of lines to read from the input stream
while( there are still lines to process )
extract the first integer on the line
extract the second integer on the line
sum the integers
insert the result onto the output stream
if any errors occurred
clear the stream
tell the user about the error
give up
Now if you wrap this lot up into a function that take an std::ostream and an std::istream you'll actually get something you can unit test and will work with console IO as well as files and even string.
Cheers,
Ash