Question
#include #include using namespace std; // Erik Donovan const int MAXNAME = 20; int main() { ifstream inData; inData.open(grades.txt); char name[MAXNAME + 1]; // holds
#include
// Erik Donovan
const int MAXNAME = 20;
int main() { ifstream inData; inData.open("grades.txt");
char name[MAXNAME + 1]; // holds student name float average; // holds student average char studentName;
inData.get(name, MAXNAME + 1); while (inData) { inData >> average; inData >> studentName; cout << studentName << " has a(n) average of" << average << endl; // 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 inData.ignore(100, ' ');
if (inData) { inData.get(name, MAXNAME + 1); cout << studentName << " has an average of" << average << endl; } cin.get(); system("pause"); return 0; } }
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