Student data should be stored in a struct variable of type StudentType , which h
ID: 3615658 • Letter: S
Question
Student data should be stored in a struct variable of typeStudentType, which had four components:studentFName and studentLName of typestring,
testScore of type int (testScore isbetween 0 and 100), and
grade of type char.
Suppose that the data has 20 students. Use an array of 20components of type studentType.
Program must contain at least the following functions:
A function to read the students data into the array
A function to assign the relevant grade to each student
A function to print the names of the students having the highesttest score.
Program must output each students name in this form: Last name,followed by a comma, followed by a space, followed by first name,and the name must be left justified. Moreover, other than declaringthe variables and opening the input and out files, the functionmain should only be a collection of function calls.
List of students and grades:
(18A.txt)
Bob Smith 87
Mike Christy 90
Steven Michaels 33
Michael John 78
Amy Clark 99
Nicole Hasty 91
Bob Robert 89
Chris Nash 77
Chris Thomas 67
Joe Tea 93
Bob Young 87
Mike Stevenson 95
Trent Fiore 70
Anthony Joe 82
Matt Coffee 90
Mark Tomlinson 89
Phil Rope 94
Mike Stopper 88
Mark Robinson 78
Betty Lee 77
# include<iostream>
# include <string>
# include <fstream>
using namespacestd;
const int ARRAY_SIZE =20;
structstudentType
{
string studentFName, studentLName;
char grade;
char fileName(18A.txt)
int testScore;
}
voidopenfile(ifstream& infile)
void readData (ifstream& inFile, int array[],StudentType);
void grade (grade, studentType);
void getData (int array[],int arrayLength, string,studenttype);
int highScore( int testScore, 0-100, student)
int main ()
{
ifstream infile;
ofstream outfile;
string inputFile;
string outputFile;
infile.open (18A.txt)
cout << " Highest score in the class is:"
cin >>highestScore;
Here is what I have so far but not really sure what direction tohead in? Any help would be great! Thanks.