The errors?

Tried running this below..It compiles but I don't understand errors around lines 45-47

#include <iostream>

#include <fstream>

#include <string>

using namespace std;

struct studentType

{

string studentFName;

string studentLName;

int testScore;

char grade;

};

void getData(ifstream &inFile, studentType sList[], int &listCount)

{

int x = 0;

if (inFile.fail())

{

cout << "File doesn't exist" << endl;

exit(0);

}

while (inFile && x < listCount)

{

inFile >> sList.[x].studentFName >> sList[x].studentLName

>> sList.[x].testScore;

x++;

}

inFile.close();

}

void calculateGrade(studentType sList[], const int listSize)

{

cout << "Students and Grades" << endl;

for (int i = 0; i<listSize; i++)

{

if (sList[i].testScore > 89)

sList[i].grade = 'A';

else if (sList[i].testScore > 79)

sList[i].grade = 'B';

else if (sList[i].testScore > 69)

sList[i].grade = 'C';

else if (sList[i].testScore > 59)

sList[i].grade = 'D';

else

sList[i].grade = 'F';

cout << sList[i].studentLName << "," << " " << sList[i].studentFName

<< " " << sList[i].testScore << " " << sList[i].grade << endl;

}

}
Please use code tags.
Thank you!
It doesn't compile. This is not valid code
1
2
sList.[x].studentFName
sList.[x].testScore


You also don't have a main function.
Topic archived. No new replies allowed.