How do I ignore the first column of data from a file? I need to read the three exam scores into an array; however, the first column contains the student ID. The next 3 columns contain exam scores. (Please do not use the standard library we have not learned it.)
Here is what the data file looks like. I need the bolded part of the data. (it is up to 250 rows, but I must assume there will be less than 300 students):
Here is my input fuction part of the code so far:
I am instructed to use structures for this program. Currently it is reading all of the data into the grades array which is not what I want to do.
Can anyone help me out? The code input is skipping for first line too. Also, for some reason it is printing 50 extra rows with "85". I am not sure why because I put:
struct exam
{
int score1;
int score2;
int score3;
}
exam my_exam [300];
int discard, count=0;
///after file is successfuly opened.
while (file)
{
file>> discard;
file>>my_exam [count].score1>> my_exam [count].score2>> my_exam [count].score3;
++count;
}//can only work fine if atleast 300 students scores are present.