I am currently working on a program for c++ class that will process and generate a student transcript for a semester assuming that the student is taking five classes.(Output is printed to the screen in a chart format). The student will enter three grades for each course. There should be one array for the course names, first exam grades, second exam grades, and third exam grades.
Alright, fair enough. Well I have managed to initialize the above arrays and output them correctly in the below code. Here is where I am a bit confused. Next, I have to initialize an array that will calculate the average of the three exam grades for each course and initialize an array for the letter grades for the averages of each course.(and print them to the screen in the same fashion as the exam grades and course names.) Perhaps if somebody could shed light upon how to create an array that will calculate the average of the three grades, I could try and figure out how to make an array for the letter grades. Thank you.
# include iostream
using namespace std;
const int SIZE =5;
void getData(string courseName[], float examOne[], float examTwo[], float examThree[]);
int main ()
{
// local declaration
string courseName[SIZE];
float examOne[SIZE];
float examTwo[SIZE];
float examThree[SIZE];
getData(courseName,examOne,examTwo,examThree);
cout<<"\n\n\n";
for (int i = 0; i <SIZE; i++){
cout<< courseName[i]<<" "<<examOne[i]<<" "<<examTwo[i]<<" "<<examThree[i]<<" "<<total[i]<< endl;
}
return 0;
}
void getData(string courseName[],float examOne[],float examTwo[],float examThree[]){
for (int i = 0; i <SIZE; i++){
cout<<"Enter Course Name: ";
cin >> courseName[i];
cout<<"enter First Exam Grade: ";
cin>>examOne[i];
cout<<"enter Second Exam Grade: ";
cin>>examTwo[i];
cout<<"enter Third Exam Grade: ";
cin>>examThree[i];
}
}