How to divide array?

Hey guys, it's me again! I just want you to help me getting done with this code. My program is about getting General Weighted Average by dividing the subject_grade and the subject_unit. So, I hope you can help me :)
Here's my code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <iostream>
using namespace std;

int main()
{
    int count, c, GWA=0;
    
    cout << "Enter subjects count: ";
    cin >> count;
    float * subject_grade = new float[count];
    for (c=0;c<count;c++)
    {
        cout << "Enter subject number " << c+1 << " grade: ";
        cin >> subject_grade[count];    
        
        float * subject_unit = new float[count];
        cout << "Enter subject units: ";
        cin >> subject_unit[count];
        
        GWA=subject_units/subject_grade;
    }
    cout << "Your total Grade/General Weighted Average is: " << GWA << "\n";
    return 0;
}
Move line 16 before line 11.
line 14/18: Replace count with c.
line 20 I would guess: GWA+=subject_units[c]/subject_grade[c];.
line 22 for average you need to divide by the amount: GWA/count. Take care that count > 0.
Can you please write down the code for me dude? :)
warshock10 wrote:
Can you please write down the code for me dude? :)


Dude why do you want to do no work?

I thought that the point of you asking things on this forum was to get understanding not to have others just do the work for you.

I am not sure if you understand the point of this forum.

Please take a look at the following webpage:
http://www.cplusplus.com/forum/beginner/1/

Please understand we want to help you, but not do the work for you.
Last edited on
Topic archived. No new replies allowed.