Question: I don't understand the errors I'm getting for this problem: //Taylor Wyss //11/22/17 //CSC160C11 #include #include #include using namespace std; //Declares the correct strings, ints,
I don't understand the errors I'm getting for this problem:
//Taylor Wyss
//11/22/17
//CSC160C11
#include
#include
#include
using namespace std;
//Declares the correct strings, ints, and chars under student type
struct studentType
{
string studentFName;
string studentLName;
int testScore;
char grade;
}
studentsData[20];
//Declares the necessary functions
int readStudents(ifstream &inputFile, studentType studentsData[]);
void letterGrades(studentType studentsData[]);
void printsData(ofstream &outputFile, studentType studentsData[]);
void hightestScores(ofstream &outputFile, studentType studentsData[]);
int main()
{
ifstream inputFile;
ofstream outputFile;
inputFile.open("Ch9_Ex2Data.txt");
//Checks to make sure input file is there and can be opened
if (!inputFile)
{
cout
system("pause");
return 0;
}
//Runs the functions
else
{
int s;
outputFile.open("StudentData.txt");
s = readStudents(inputFile, studentsData);
letterGrades(studentsData);
printsData(outputFile, studentsData);
highestScores(outputFile, studentsData);
outputFile.close();
inputFile.close();
system("pause");
return 0;
}
}
int readStudents(ifstream &inputFile, studentType studentsData[])
{
int s = 0;
inputFile >> studentsData[s].studentFName >> studentsData[s].studentLName >> studentsData[s].testScore;
while (inputFile)
{
s++;
inputFile >> studentsData[s].studentFName >> studentsData[s].studentLName >> studentsData[s].testScore;
}
return s;
}
//Assigns the correct letter grade to the corresponding grade for a student
void letterGrades(studentType studentsData[])
{
int i = 0;
int numberGrade = studentsData[i].testScore;
while (i
{
if (numberGrade = 90)
{
studentsData[i].grade = 'A';
}
else if (numberGrade = 80)
{
studentsData[i].grade = 'B';
}
else if (numberGrade = 70)
{
studentsData[i].grade = 'C';
}
else if (numberGrade = 65)
{
studentsData[i].grade = 'D';
}
else
{
studentsData[i].grade = 'F';
}
i++;
}
}
//Prints Data to the file
void printsData(ofstream &outputFile, studentType studentsData[]);
{
outputFile
outputFile
for (int i = 0, i++, i
{
outputFile
}
}
//Finds the highest test score
void highestScores(ofstream &outputFile, studentType studentsData[])
{
int max = 0, i;
for (i = 1, i++, i
{
if (studentsData[i].testScore > studentsData[max].testScore)
{
max = i;
}
if (studentsData[i].testScore == studentsData[max].testScore)
{
outputFile
}
}
}
Problem is supposed to take data from an input file read it, store it in array, and then output it into another file with the highest scores. I'm getting these errors.
:
Ouick Launch (Cn-o D StudontProgrom Micosoft Visual Studio Express 2015 for Windows Desktop File Edit View Projcct Dabug Toam Tools Test Window Hclp Taylor VWiyss T Error List ntire Solulio * 7 Crrors | 0 Warnings 1 0 0 Messages | Build-helliSense Search Errer Lis Code Description Project Hle Line Suppression State i+ (studentsC2143 synax error missing before 120 123 outputFile| *symtre 3 C2143 staemr. missing bofom C2143 Syrtax error missing before Y' StudentProgram source cpp 131 132 133 2447 C3B6 ighestSucres': identifier nat feund ,t: missing tunction header (old-style tormal list?) StudentProgram source cpp 51 Build started: Project: StudentProgron, ca 1x 1> Source.cpp 1c: Lusers sophia docunentsvisul studio 29151,pr 1c: Lusers sophia docunentsvisul studio 29151,pr Build: suceeeded, 1 failed, up-LU- Output Properlies :27 PM Type here to search
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
