
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
is "i" undefined?? What can I do to fix this
![#include <iostream>
#include <string>
#include <fstream>
#include <iomanip>
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';](https://content.bartleby.com/qna-images/question/13cdb483-7b2c-41f3-abc0-f0a8e5a29555/404cc873-7325-4a06-8e0d-1c9d6a1ab105/33r52e.png)
Transcribed Image Text:#include <iostream>
#include <string>
#include <fstream>
#include <iomanip>
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;](https://content.bartleby.com/qna-images/question/13cdb483-7b2c-41f3-abc0-f0a8e5a29555/404cc873-7325-4a06-8e0d-1c9d6a1ab105/5dd0ln7.png)
Transcribed Image Text: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;
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 nowThis is a popular solution!
Step by stepSolved 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.Similar questions
- Python help Make the game Hanoi Tower. Ask first how many disks there are. After then, ask from the user the rods that will be used to remove and insert the disk. The program should verify the game's rules and see if the user has finished the task. After, Create an algorithm to solve the Tower of Hanoi, then test it with no more than six disks.arrow_forwardBuild a polyhedron that looks roughly like the Washington monument. Some key dimensions of the Washington Monument: o The width of the base is about 55 feet.o The width of each side at the top is about 34 feet.o The height of the small pyramid (pyramidion) at the top of the monument is 55 feet. o The height of the whole monument is 555 feet. This should help you get something that looks approximately like the Washington monument. Exactness is not necessary, and indeed, you should make your code appropriately parameterized.Some additional requirements. Your polyhedron will have 8 sides (four for the pyramidion and four for the tower). You should not have a base. The origin of the monument should be at the center of the base, directly below the peak. Each side should be a different color, so that all the edges are plainly visible. o Use a variety of different ways of specifying the colors (e.g. THREE.ColorKeywords, hexidecimal notation, CSS string, RGB) o Use RGB color at least…arrow_forwardPlease help with this question!! Please provide explanations as well!arrow_forward
- what is For...Next statement ?arrow_forwardBuild a polyhedron that looks roughly like the Washington monument. Some key dimensions of the Washington Monument: o The width of the base is about 55 feet.o The width of each side at the top is about 34 feet.o The height of the small pyramid (pyramidion) at the top of the monument is 55 feet. o The height of the whole monument is 555 feet. This should help you get something that looks approximately like the Washington monument. Exactness is not necessary, and indeed, you should make your code appropriately parameterized.Some additional requirements. Your polyhedron will have 8 sides (four for the pyramidion and four for the tower). You should not have a base. The origin of the monument should be at the center of the base, directly below the peak. Each side should be a different color, so that all the edges are plainly visible. o Use a variety of different ways of specifying the colors (e.g. THREE.ColorKeywords, hexidecimal notation, CSS string, RGB) o Use RGB color at least…arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

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