All the instructions are
*Write a for loop
*Then a while loop
*Then a for loop.
*Then do some if elses.
*...
*Then fill in the blanks of this ridiculously hard to understand code because of all the holes.
Oh, just to make it more challenging, we copy pasted the code and lost all indentation structure.
IMO, these kind of assignments require more skill in concentration and following instructions then actual programming skills...
At least it uses proper c++ I guess: no <iostream.h> here...
Is your question related to IO?
Read this C++ FAQ article at parashift by Marshall Cline. In particular points 1-6.
It will explain how to correctly deal with IO, how to validate input, and why you shouldn't count on "while(!in.eof())". And it always makes for excellent reading.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.