Yes, this is for a class. I don't want anyone to write it for me. I just don't understand exactly how to implement a few things...
Ok, I have a file with names and grades in it, one name and 5 grades on each line. I have a function that takes one line and puts it into a structure array StudentInfo stud_info[24]. I have an array since there is more than one student. Well, the problem is that I need a function that takes the current line and puts it alphabetically into the right place in the array StudentInfo stud_info[24].
All I need to do is locate the position where to insert the student and move all the students starting from this position one position down, and insert the data, but I don't know exactly how I should go about doing that without a ridiculous amount of excess code.
Another thing is my ReadLine function. If you look at the attached code, you can see the entire function. Well, initializing with the pointer doesn't exactly work right, and I don't know why.
void ReadLine(istream &inp, StudentInfo *student) { ... }
this is how I'm calling it:
while (! inp.eof() ){
ReadLine(inp, stud_info[count]);
PrintGrades(out, stud_info, count);
count++;
}
I hope I was thorough enough without giving too much information. If you made it this far, thanks for reading!
Ok, I have a file with names and grades in it, one name and 5 grades on each line. I have a function that takes one line and puts it into a structure array StudentInfo stud_info[24]. I have an array since there is more than one student. Well, the problem is that I need a function that takes the current line and puts it alphabetically into the right place in the array StudentInfo stud_info[24].
All I need to do is locate the position where to insert the student and move all the students starting from this position one position down, and insert the data, but I don't know exactly how I should go about doing that without a ridiculous amount of excess code.
Another thing is my ReadLine function. If you look at the attached code, you can see the entire function. Well, initializing with the pointer doesn't exactly work right, and I don't know why.
void ReadLine(istream &inp, StudentInfo *student) { ... }
this is how I'm calling it:
while (! inp.eof() ){
ReadLine(inp, stud_info[count]);
PrintGrades(out, stud_info, count);
count++;
}
I hope I was thorough enough without giving too much information. If you made it this far, thanks for reading!
