So, I'm using infile for the first time, I'm confuse on if I'm doing it right.
The file open up. But, it asking to calculate the average exam score. and display the average to 2 decimal places.
****Directions:
Read the data line by line . You will need several variables to read each value into. (hint: fName, lName, exam1,
exam2, exam3 …..)
- calculate the average exam score for each student
- using cout, display the exam average to 2 decimal places for each computer scientist. (i.e. 83.12)
-close the file
*****Names and exam score *****
Grace Hopper 81.5 90.0 65.5 79.9 93.2
Alan Kay 75.5 81.5 70 90 98.2
John Backus 99.0 74 100 87.7 99.9
Sergey Brin 62 100 88.5 79.7 97.3
Dennis Ritchie 97 98 100 100 99.9
Brian Kernighan 100 99 100 89 99
**Program**
#include <fstream>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <string>
using namespace std;
int main()
{