#include #include #include #include using namespace std; const int students = 20; struct studentType string studentFName; string studentLName; int testscore; char grade; }; void getdata(ifstream& inData, studentType sList[], int listsize); void calculateGrades (studentType Slist[], int listsize); int highestscore(const studentType slist[], int listsize); void printresult(ofstream& outData, const studentType Slist[], int listsize); int main() ifstream inData; ofstream outpata; studentType studentlist[students]; inData.open("Data.txt"); if (!inData) cout <« "The input file does not exist." « endl; system("PAUSE"); return 1; outData.open ("Dataout.txt"); if (loutdata) cout « "Could not open the output file." « endl; system("PAUSE"); return 1; getData(inData, studentlist, students); calculateGrades (studentlist, students); printresult(outData, studentlist, students); system("PAUSE"); return e; void getdata(ifstream& inFile, studentType sList[], int listsize) for (int i = e; i « listsize; i++) infile » slist[i].studentFName » slist[i].studentLName > slist[i].testscore; void calculateGrades (studentType Slist[], int listsize) int score; for (int i = e; i « listsize; i++) score = slist[i].testscore; // <- you were missing this. 'score' never acquired a value to compare with others if (score >= 90) slist[i].grade else if (score >= 80) Slist[i].grade = 'B'; else if (score >= 70) sList[i].grade = else if (score >= 60) slist[i].grade = 'D'; else = 'A'; '; sList[i].grade = 'F'; int highestscore(const studentType sList[], int listsize) int score[180]; int highscore - score[e]; for (int i = e; i « listsize; i++) if (score[i] > highscore) highscore = score[i]; } void printresult(ofstream& outFile, const studentType sList[], int listsize) int maxScore = highestscore(SList, listsize); int i; outFile <« setw(15) <« "student Name" <« setw(10) <« "Test Score" « setw(7) <« "Grade" <« endl; for (i = 1; i < listsize; i++) outFile <« left <« setw(25) « SList[i].studentLName + ", " + sList[i].studentFName << right «" " « setw(5) <« Slist[[i].testscore « setw(6) <« " " « Slist[i].grade <« endl; outFile <« endl <« "The higest test score is: " <« maxScore <« endl; outFile « "students the have the higest test scores are:" « endl; for (i = 1; i « listsize; i++) if (slist[i].testscore == maxScore) outFile « slist[i].studentlName + + slist[i].studentFName <« endl;
#include #include #include #include using namespace std; const int students = 20; struct studentType string studentFName; string studentLName; int testscore; char grade; }; void getdata(ifstream& inData, studentType sList[], int listsize); void calculateGrades (studentType Slist[], int listsize); int highestscore(const studentType slist[], int listsize); void printresult(ofstream& outData, const studentType Slist[], int listsize); int main() ifstream inData; ofstream outpata; studentType studentlist[students]; inData.open("Data.txt"); if (!inData) cout <« "The input file does not exist." « endl; system("PAUSE"); return 1; outData.open ("Dataout.txt"); if (loutdata) cout « "Could not open the output file." « endl; system("PAUSE"); return 1; getData(inData, studentlist, students); calculateGrades (studentlist, students); printresult(outData, studentlist, students); system("PAUSE"); return e; void getdata(ifstream& inFile, studentType sList[], int listsize) for (int i = e; i « listsize; i++) infile » slist[i].studentFName » slist[i].studentLName > slist[i].testscore; void calculateGrades (studentType Slist[], int listsize) int score; for (int i = e; i « listsize; i++) score = slist[i].testscore; // <- you were missing this. 'score' never acquired a value to compare with others if (score >= 90) slist[i].grade else if (score >= 80) Slist[i].grade = 'B'; else if (score >= 70) sList[i].grade = else if (score >= 60) slist[i].grade = 'D'; else = 'A'; '; sList[i].grade = 'F'; int highestscore(const studentType sList[], int listsize) int score[180]; int highscore - score[e]; for (int i = e; i « listsize; i++) if (score[i] > highscore) highscore = score[i]; } void printresult(ofstream& outFile, const studentType sList[], int listsize) int maxScore = highestscore(SList, listsize); int i; outFile <« setw(15) <« "student Name" <« setw(10) <« "Test Score" « setw(7) <« "Grade" <« endl; for (i = 1; i < listsize; i++) outFile <« left <« setw(25) « SList[i].studentLName + ", " + sList[i].studentFName << right «" " « setw(5) <« Slist[[i].testscore « setw(6) <« " " « Slist[i].grade <« endl; outFile <« endl <« "The higest test score is: " <« maxScore <« endl; outFile « "students the have the higest test scores are:" « endl; for (i = 1; i « listsize; i++) if (slist[i].testscore == maxScore) outFile « slist[i].studentlName + + slist[i].studentFName <« endl;
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
is "i" undefined?? What can I do to fix this
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education