Producing a Table with Data from File

This is a discussion on Producing a Table with Data from File within the C++ Programming forums, part of the General Programming Boards category; Hi everyone,
I'm currently working on a program that will give me the averages of scores and stores them into ...

Producing a Table with Data from File

Hi everyone,

I'm currently working on a program that will give me the averages of scores and stores them into a one-dimensional arrray. I'm having trouble in regards to where I should be putting the code that will give me the table for my calculations.
Before or after my calculations?

I can have 2-7 numbers of scores. This particular example has 4, but I have to write the code so that it is able to some me score #1, #2, #3-#7. Can I used a for loop for this as well?

ALSO, I'm having trouble with this part:

Code:

AvgStudentScore[row]= (float) sum/num;

Since I'm supposed to store the average (sum being double and num being int) into a float array (AvgStudentScore[])
How can I convert the calculation to a float?

You're worrying me here. Why, exactly, do you think that you have NOT "writ[ten] the code so that it is able to some me score #1, #2, #3-#7"? (I am assuming that the part I have quoted should say "writ[ten] the code so that it is able to sum up scores #1, #2, and #3-#7 if they exist".)

I'm aware that it should be doing it for me, however, I was receiving an error/warning (don't recall which) that said that it could not be converted. I compiled my program again and it shows zero errors and warnings... what do ya know...

My question still is, where should I be placing the code for the table... this code:

You have to print the header before you print any of the rows. Since it appears you are printing the rows inside the for loop, the code would have to go before that.

Edit: Actually I misread that -- no printing inside the for loop. In that case it doesn't make a bit of difference when you print the header, as long as it's before the first row is printed. (I would probably do all the printing at once, but nobody cares, really.)