I have to do the program below using this skeleton , can you help me? #include <
ID: 3668375 • Letter: I
Question
I have to do the program below using this skeleton , can you help me?
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;
void printFileToScreen();
int main()
{
//close the input file here
printFileToScreen();
return 0;
}
void printFileToScreen()
{
ifstream inData;
string line = "";
inData.open("class_statistics.txt");
while(inData)
{
getline(inData,line);
cout << line << endl;
}
inData.close();
}
Create a program to handle a college class grades:
Capture the Teacher's name
Capture the Class designation
The program should ask how many students are in the class and do the following for each student:
Read the students name
Read in up to 10 grades for the student (from 0 - 100 is acceptable. If outside the range don't use the input, ask for a correction , 999 should stop input of grades if there are less than 10)
Calculate the average of the student's grades
Compute the student's grade as a letter grade
For the entire class
Compute the class's grade average
Determine how many A's, B's, C's, D's and F's are in the class.
Write the following data to a file called class_statistics.txt
Teacher: Bob Marley
Class: CGS1010
Student Name: Jim Beam Average: 88 Grade: B
Donna Jenner 95 A
Student count: 2
Student average: 91.5
A's: 1
B's: 1
C's: 0
D's: 0
F's: 0
Explanation / Answer
#include<iostream.h>
#include<conio.h>
void main()
{
char t[30], cl[20],n[30], gr;
int a[20],tot=0,gra=0, grb=0, grc=0, grd=0, grf=0;
cout<<"Enter Teacher:";
cin>>t;
cout<<"Class: ";
cin>>cl;
for(int i=0;i<2;i++)
{
cout<<"Student Name:";
cin>>n;
cout<<" Average:";
cin>>a[i];
tot=tot+a[i];
cout<<" Grade:";
cin>>gr;
if(gr=='A')
gra++;
if(gr=='B')
grb++;
if(gr=='C')
grc++;
if(gr=='D')
grd++;
if(gr=='F')
grf++;
cout<<" ";
}
cout<<"Student average:" <<(tot/2)<<endl;
cout<<"A's: "<<gra<<endl;
cout<<"B's: "<<grb<<endl;
cout<<"C's: "<<grc<<endl;
cout<<"D's: "<<grd<<endl;
cout<<"F's: "<<grf<<endl;
}