Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I am having lots of trouble with this program and I know i need to read more, I

ID: 3545739 • Letter: I

Question

I am having lots of trouble with this program and I know i need to read more, I am really falling behind.Hopefully you can help me.


this program opens a text file, then it reads first name, last name, and test score. then it assigns scores and displays students by name, score, test score range, and highest score. here is what I have so far




#include<iostream>

#include<fstream>

#include<string>


using namespace std;


struct StudentType

{string studentName;

int testScore;//Between 0 and 100

char grade;



};


void PrintNameHeader(ostream& out);

bool OpenInputFile(ifstream& inFile, string& infilename ); //OPEN input file

void Pause();// Pause

void ReadStudentData(ifstream& infile, StudentType student[], int& );// Read student infp including first and last name and test score

void AssignGrades(StudentType student[], int);//assign grades to each student

int HighestScore(const StudentType student[], int );//Get the highest scores

void PrintNamesWithHighestScore(const StudentType student[], int);//Print name/s with highest Scores

void DisplayAllStudents(const StudentType student[], int);//Display all students

void GetLowHighRangeValues(int& , int&);//for example a student types 50 100 , it will get all students within that range

void DisplayStudentsInRange(const StudentType student[], int, int, int);// display students in that range

void SortStudentsByName(StudentType student[], int);// sort students by name

void SortStudentsByScore(StudentType student[], int);// sort students by test score highest to lowest


const int NUM_STUDENTS = 20;




int main()

{


ifstream infile;

string inFilename;




StudentType student[NUM_STUDENTS];


int numStudents = 0;


PrintNameHeader(cout);


OpenInputFile(infile,inFilename);


ReadStudentData(infile, student, numStudents);



return 0;

}


//Function definitions


void PrintNameHeader(ostream& out)//Completed

{

cout <<"My name << endl;


}

bool OpenInputFile(ifstream& inFile, string& infilename) //COMPLETED

{




cout << "Enter the name of the .txt file that you want to open for input. ";

cout << "Do not put spaces in the file name ";

cin >> infilename;

cout << endl;



inFile.open(infilename.c_str());

if (inFile.fail())

{

cout << "Sorry, the input file " << infilename <<" was not found"<< endl;

return false;   

}


cout << "Input file " << infilename << " is open for reading. ";

return true;     

}


void Pause()

{

cout << endl;


cin.ignore(80, ' ');


cout<<"Please hit the enter key to continue... ";


cin.get();


}


void ReadStudentData(ifstream& infile, StudentType student[], int& numstudents)

{

string firstName,

LastName,

testScore;


int count = 0;


StudentType fullname;




if( infile)


for (int count; count < NUM_STUDENTS; count++)

{

cin >> firstName[count] >> LastName[count] >> testScore[count];


fullname[count]= firstName +  ", " + LastName;


}





numstudents = count;

cout << numstudents << endl;





}

void AssignGrades(StudentType student[], int numstudents)

{


int testscore;


char grade;


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

{

if(testscore >= 90 && testscore <=100)


grade = 'A';


else if(testscore >= 80 && testscore <90)


grade = 'B';


else if(testscore >= 70 && testscore <80)


grade = 'C';


else if(testscore >= 60 && testscore <70)


grade = 'D';


else


grade = 'F';

}


}

int HighestScore(const StudentType student[], int numstudents)

{

int Students = 6;////dummy


return Students;

}

void PrintNamesWithHighestScore(const StudentType student[], int numstudents)

{


}

void DisplayAllStudents(const StudentType student[], int numstudents)

{


}

void GetLowHighRangeValues(int& lowRange, int& highRange)

{


}


void DisplayStudentsInRange(const StudentType student[], int numStudents, int lownum, int highNum)

{


}


void SortStudentsByName(StudentType student[], int numStudents)

{


}


void SortStudentsByScore(StudentType student[], int numstudents)

{


}

Explanation / Answer

Hi


cheers