Menu
support@authoritypapers.com
+1(805) 568 7317

this won 39 t compile and i don 39 t know what is wrong any help is appreciated than 5189500

This won't compile and I don't know what is wrong.. any help is appreciated! Thank you!

#include
#include
#include
#include

using namespace std;

//Declare a structure variable of type studentType

struct studentType
{
//Declare four components
string studentFName, studentLName;
char grade;
int testScore;
}
students[20];
//Function prototypes
int readStudentData(ifstream& inputFile, studentType students[]);
void getgrade(studentType students[], int n);
void displayData(ofstream& outputFile, studentType students[], int n);
void highestTestScore(ofstream& outputFile, studentType students[], int n);
bool openInputFile(ifstream& inputFile, char filename[]);
void openOutputFile(ofstream& outputFile, char filename[]);

//main method
int main()
{
//Declare variables
int n;
bool status;
//Create the input and output files
ifstream inputFile;
ofstream outputFile;
status=openInputFile(inputFile, “input.txt”);
if(status)
{
openOutputFile(outputFile, “output.txt”);
//Function calls
n=readStudentData (inputFile, students);
getgrade(students, n);
displayData(outputFile, students, n);
highestTestScore(outputFile, students, n);
//Close output file
outputFile.close();
//Close input file
inputFile.close();
}
//Pause the system
//system(“pause”);
return 0;
}

//Method definition of openInputFile
bool openInputFile(ifstream& inputFile, char filename[])
{inputFile.open (filename);
if(inputFile.fail())
{
cout
//system(“pause”);
return false;
}
return true;
}

//Method definiton of readStudentData
int readStudentData(ifstream& inputFile, studentType students[])
{
int n=0;
inputFile >> students[n].studentFName >> students[n].studentLName >> students[n].testScore;
while(inputFile)
{
n++;
inputFile >> students[n].studentFName >> students[n].studentLName >> students[n].testScore;
}
return n;
}

//Method definition of getgrade
void getgrade( studentType students[], int n)
{
int i;
for(i=0;i
switch((int)(students[i].testScore/10))
{
case 10:
case 9: students[i].grade='A';
break;
case 8: students[i].grade='B';
break;
case 7: students[i].grade='C';
break;
case 6: students[i].grade='D';
break;
default: students[i].grade='F';
break;
}
}

//Method definition of displayData
void displayData(ofstream& out, studentType students[], int n)
{
out
out
for(int i=0;i
{
out

out

}
}

//Method definition of highestTestScore
void highestTestScore(ofstream& out, studentType students[], int n)
{
int max = 0, i;
for(i = 1; i
if(students[i].testScore > students[max].testScore)
max = i;
out
out
for (i=0;i
if(students[i].testScore==students[max].testScore)
out
}
//Method definition of openOutputFile
void openOutputFile(ofstream& outputFile, char filename[])
{
outputFile.open(filename);
}

"Order a similar paper and get 15% discount on your first order with us
Use the following coupon
"GET15"

Order Now