Write a C++ program that: 1- Reads records from a file named input.txt. 2- Each
ID: 3635798 • Letter: W
Question
Write a C++ program that:1- Reads records from a file named input.txt.
2- Each record contains the last name of a student and 5 test scores (type double) in the following format: Smith 89.0 75.2 90.3 75.1 80.0
3- For each record
a. Calculate the average test score
b. Convert the numeric average to a letter grade using the CVCC scale.
c. Output a record to the file output.txt in the following format: Smith 81.9 B
4- You must create the file input.txt in the appropriate folder. Enter at least 5 records.
5- The NAME is right justified in a field 10 characters wide. The fill character is asterisk (*).
6- The numeric grade is right justified in a field 8 characters wide. The fill character is space ( ).
7- The letter grade is output in a field 1 character wide.
8- You may use in-line code to do the grade conversion.
Explanation / Answer
#include #include #include #include using namespace std; // function prototype char getGrade(double avg); // main function int main() { // opens input file ifstream infile; infile.open("input.txt"); // checks file existence if(infile.fail()) { coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.