Sorry for the late response -- Someone needed me in real life for a while and I just got back.
@
b29hockey
Do not loop on EOF.
@
jlb
You are close to correct. The professor accidentally left off an important piece of information: the delimiting character should be a space.
17 18 19 20
|
inData.get(name, MAXNAME + 1, ' ');
while (inData)
{
|
This
is correct code, though it does not follow your standard C++ idiom. OP's professor may have done this on purpose so that his students understand what is being done before teaching the normal idiom.
At no time can it overflow the array.
@
bankaijoey
Make sure you do mention the missing delimiter character to your professor.
Where it says "FILL IN THE CODE to print out name and student average" ... it is already done. (I don't know if you did that or if you just did it and stuck in above the comment.)
Where it says "FILL IN THE CODE to complete the while loop...", remember that you must read two things every time through the loop: the
name and the
grade.
1 Before entering the loop, you read the name.
2 If that was successful, you entered the loop.
- Inside the loop, you get the grade.
- What must you do inside the loop before going back to step 2 (looping back to step 2)?
Hope this helps.