Code:
if (count ==1)
count = 1;
else if (count == 2)
count = 2;
else if (count == 3)
sum = sum + num;
else if (count > 3)
count = 1;
The marked sections don't do anything useful. Perhaps you can do away with the whole if-statement for count == 1 and count == 2?
And yes, your code does not read the number in for your last section of code. Compare it to your other funcitonality.
Overall, there is quite a bit of repetition in this code. It could be written much shorter by some use of functions. And you don't really need to close/re-open the input file, you could just set the current input to the beginning (using "seekg(0)").
--
Mats