Please I need help figuring out how to output onto the main screen 46 grades com
ID: 3642182 • Letter: P
Question
Please I need help figuring out how to output onto the main screen 46 grades computed by one of my member functions. also i need the names of the students to appear next to the grades.Please help me, no one so far has been answering my question......Here is my code:
#include <iostream>
#include <fstream>
#include <string>
#include <iomanip>
using namespace std;
void MainMenu ()
{
cout <<""<< endl;
cout <<" =================================================================="<< endl;
cout <<" Computation of Final Grades of Students initiated "<< endl;
cout <<" =================================================================="<< endl;
}
class myStudent
{
private:
char fname[46];
int midExam[46];
int finExam[46];
double QuizAvg[46];
double finGrade[46];
public:
void getData ();
void showFinGrade ();
double calFinGrade ();
};
void myStudent::getData ()
{
ifstream Student_data;// opens students data
Student_data.open("FirstName.txt");// opens the names of the student and puts it in a 1D array.
for(int i=0; i<46; i++)
{
Student_data >> fname[i];
}
Student_data.open("QuizAvg.txt");// opens the Quiz avgs and puts them into a 1d array.
for(int j=0; j<46; j++)
{
Student_data >> midExam[j];
}
Student_data.open("MidtermExam.txt");
for(int k=0; k<46; k++)
{
Student_data >> midExam[k];
}
Student_data.open("FinalExam.txt");
for(int f=0; f<46; f++)
{
Student_data >> finExam[f];
}
}
void myStudent::showFinGrade ()
{
cout <<setw(50)<< *fname<<setw(50) << *finGrade <<endl;
}
double myStudent::calFinGrade()
{
for(int z=0; z<46; z++)
finGrade[z] = 0.35*midExam[] + 0.3*QuizAvg[] + .35*finExam[];
return finGrade[46];
}
int main()
{
int sum=0;
MainMenu();
myStudent students[46];
cout<<setw(46) <<" Last Name"<< setw(46) <<" Final Grade " << endl;
for (int i= 0; i<46; i++)
{
students[i].getData();
students[i].calFinGrade();
students[i].showFinGrade();
}
system("pause");
return 0;
}
If not show me how it can be done , at least give me a structure of how the program should look.
THANK YOU.