Question: Using C++ Please write a program to read 10 grades from a file and display the average. This will include the functions getFileName ), displayAverage

Using C++

Using C++ Please write a program to read 10 grades from a

Please write a program to read 10 grades from a file and display the average. This will include the functions getFileName ), displayAverage and readFile(): main leNameaverag getFileName readFile display getFilename () This function will prompt the user for the name of the file and return it. The prototype is: void getFileName (char fileName []); Note that we don't return text the way we do integers or floats. Instead, we pass it as a parameter. We will learn more how this works in Section 3 readFile ) This function will read the file and return the average score of the ten values. The prototype is: float readFile (char fileName []) Hint: make sure you only read ten values. If there are more or less in the file, then the function must report an error. Display the following message if there is a problem with the file: Error reading file "grades.txt" display ) This function will display the average score to zero decimals of accuracy (rounded). The prototypee is: void display (float average); Example Consider a file called grades.txt (which you can create with emacs) that has the following data in it: 90 86 95 76 92 83 100 87 91 88 When the program is executed, then the following output is displayed: Please enter the filename: grades.txt Average Grade: 89%

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!