Calculating the average of three grades using an array c++
NickName:red Ask DateTime:2016-12-01T09:25:43

Calculating the average of three grades using an array c++

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];

    }   
}

Copyright Notice:Content Author:「red」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/40901139/calculating-the-average-of-three-grades-using-an-array-c

More about “Calculating the average of three grades using an array c++” related questions

Calculating the average of three grades using an array c++

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 scree...

Show Detail

Computing the average of grades in C

I have write a program that allows me to firstly enter a character c followed by an integer n and n float values representing grades. Using array to store the grades I have entered and no more than...

Show Detail

Recursive function calculating average from int array three by three elements

Calculating average three by three elements and replacing those elements with the average result. Example array [1,2,7,-2,5,0, 2,8] After transformation [3,3,3,1,1,1,5,5] Something is wrong, I ca...

Show Detail

calculating average of grades in php

I am trying to find the average of student grades in php. I use forms to ask the user how many students, then get them to enter the grade for each student. then the average is displayed. my code is...

Show Detail

Python; calculate the average of three grades for each of a number of students

I have to write code that will calculate the average of three grades for each of a number of students, and display a message depending on the resulting average grades. The program needs to be able

Show Detail

How do I get an average of the last three grades for each kindergarden in SQL?

I have two tables in SQL. The first one has the names of the kindergardens and their ID's. The second table consists of grade ID's, kindergarden's ID's, their grades and the date when they were gr...

Show Detail

Counting average grades

in December I started working with Python and due to personal problems I cannot give it as much attention as I thought I could. I need help with my first basic project. I need to write a program th...

Show Detail

determining average grades and displaying letter grades

I'm working on a program for class that finds the average of 5 entered test scores then displays the letter grades relevant to each letter score. letter score is a 10 point system ( A = 90-100 B = ...

Show Detail

How to write a program that you give it 3 grades to a student in a class and it returns the average of all three

Average grades for student 1 = 85.56 Average grades for student 2 = 88.20 Average grades for student 3 = 98.00 . . . Average grades for student 30 = 97.25 Attempt: public static double averag..

Show Detail

Writing a program to write 3 grades, and then calculating the average, as well as showing the letter grades of the user input

I am running into 3 errors in my code. On line 12, it is saying that &quot;: is ignored on left of 'const char' when no variable is declared On line 29, '{': no matching token found. On line 6, ret...

Show Detail