i need my program to calculate and display the average of each group of numbers. so when the number is 5, that indicates the next 5 numbers that should be grouped together, when the number is 4, that groups the next 4 numbers, and when its 6, it groups the 6 next numbers. the book gave a hint that we should use a nested loop. the outer loop should terminate when the end of the file has been encountered. i honestly don't know how to start this thing. this is what i have so far.
using namespace std;
while(theFile >> numbers)
cout << numbers << " ";
so far i can only get all the numbers out from the text file into my program but then im confused from there.
can you guys point me out what i should do next? and would vectors help for this program?