Hello, I am having difficulty on my assignment and have no idea what is wrong or where to fix my code. The assignment is inputting data from a file into arrays, calculating the GPA, and displaying it neatly. I could use some hints on to why it is not working. My professor isn't the best, and I can't seem to wrap my brain around what is wrong.
The "StudentRecords.txt" file reads as:
12546 Amy CS1 4 81
13455 Bill CS1 4 76
14328 Jim CS1 4 64
12546 Amy CS2 4 90
13455 Bill CS2 4 85
14328 Jim CS2 4 71
12546 Amy CS3 3 90
13455 Bill CS3 3 75
14328 Jim CS3 3 69
14388 Henry CS3 3 80
15667 Peter CS3 3 45
const int iStudSize = 999;
const int iMaxCourseAmt = 99;
struct Student
{
int iId;
string sName;
string sCourseArr[iMaxCourseAmt];
int iCreditArr[iMaxCourseAmt];
int iScoreArr[iMaxCourseAmt];
int iGradeArr[iMaxCourseAmt];
};
// Converts score to GPA
int getGrade(int iScore)
{
Student data;
int iGrade = -1;
//Using the given iID, the function returns the index of the student.
//If the student does not exist in the array, -1 is returned
int getStudIndex(Student studArr[], int iId)
{
int i = 0;
while (studArr[i].iId != -1)
{
if (studArr[i].iId == iId)
return i;
else
i++;
}
return -1;
}
// Using the given iStudIndex, the function returns the index of the first available spot for recording scores
// If no any course has been recorded, then 0 is returned.
int getCourseIndex(Student studArr[], int iStudIndex)
{
int i = 0;