Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Use an \"input.txt\". to caculate the average and produce the output the input:

ID: 3624561 • Letter: U

Question

Use an "input.txt".  to caculate the average and produce the output
the input:
Steph Holmes
96.89
69.39
83.07
92.70
94.64
78.85
71.45
67.13
65.16
80.06
97.53
83.25
61.80
66.91
86.53

Output:
Student: Steph Holmes
Total number of grades: 15
Average of grades: 79.69
Grades: 61.80 65.16 66.91 67.13 69.00 71.45 78.00 80.06 83.25 83.00 86.53 92.00 94.00 96.00 97.00
Grade: C+

The output grade is sorted in ascending order and The plus range starts at x7.0, where x is an int like 9, 8. So for example, the B+s start at 87.0, C+s start at 77.0

The "regular" range is between, x3.0 and less than x7.0. So for example, the As start at 93.0. The Bs start at 83.0 and end less than 87.0

The minus range starts at x0.0 and is less than x3.0. So for example, the A-s are from 90.0 to less than 93.0.

Please Help Thanks !!!

Explanation / Answer

please rate - thanks

#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;
int main()
{ifstream in;
string name;
int i,j;
char let,pOrM;
double average,grade[50],total=0,t;
int n=0;
in.open("input.txt");        
   if(in.fail())            
       { cout<<"input file did not open please check it ";
        system("pause");
        return 1;
        }
getline(in,name);
in>>grade[n];
while(in)
   {
total+=grade[n];
   n++;
   in>>grade[n];
       }
in.close();
for(i=0;i<n-1;i++)
    for(j=i;j<n;j++)
      if(grade[i]>grade[j])
         {t=grade[i];
         grade[i]=grade[j];
         grade[j]=t;
         }
average=total/n;
cout<<"Student: "<<name<<endl;
cout<<"Total number of grades: "<<n<<endl;
cout<<"Average of grades: "<<setprecision(2)<<fixed<<average<<endl;
cout<<"Grades: ";
for( i=0;i<n;i++)
      cout<<grade[i]<<" ";
cout<<endl;
if(average>=90)
      let='A';
else if(average>=80)
      let='B';
else if(average>=70)
      let='C';
else if(average>=60)
      let='D';
else
      let='F';
pOrM=' ';
i=(int)average%10;
if(i>=7)
     pOrM='+';
else if(i>=0&&i<3)
     pOrM='-';
cout<<"Grade: "<<let<<pOrM<<endl;

system("pause");
   return 0;
     }