Question
Bring in program grades.cpp and grades.txt from the Lab 10 folder. Fill in the code in bold so that the data is properly read from
Bring in program grades.cpp and grades.txt from the Lab 10 folder. Fill in the code in bold so that the data is properly read from grades.txt.
The code of grades.cpp is as follows:
#include
#include
using namespace std;
// PLACE YOUR NAME HERE
const int MAXNAME = 20;
int main()
{
ifstream inData;
inData.open(\"grades.txt\");
char name[MAXNAME + 1]; // holds student name
float average; // holds student average
inData.get(name,MAXNAME+1);
while (inData)
{
inData >> average; // Fill in the code to print out name and // student average
// Fill in the code to complete the while // loop so that the rest of the student // names and average are read in properly
}
return 0;
}
Grades.txt file
Adara Starr 94 David Starr 91 Sophia Starr 94 Maria Starr 91 Danielle DeFino 94 Dominic DeFino 98 McKenna DeFino 92 Taylor McIntire 99 Torrie McIntire 91 Emily Garrett 97 Lauren Garrett 92 Marlene Starr 83 Donald DeFino 73
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started