I was reading the GPA score thread but it didn't help me any. i am suppose to be making a program that should prompt the user to enter up to 30 GPA's which are stored in a single dimension array. each time the user enters a GPA they should have the option to calculate the current GPA's or add another..
Help Please!!

sorry...
this is crazy they would give me a programming class before an introduction to programming..
i can show you what i have, but i actually need the whole thing..lol
this is not my forte' i make web pages in Dreamweaver , with no coding needed. lol

#include <iostream>
using namespace std;

int main ()
{
    float fAverages[31], c [100], a, a1, GPA_scores, total_scores, Cummalative_GPA; 

    cout <<"Enter GPA scores:  "; 
    cin>>a;
    cout <<"-------------------------------------------- \n"; 
    a1=0; 
    total_scores=30;

    for (int i=0; i<=a;i++)
    {	
        cout <<"calculate Gpa’s  "<< i <<":     " ;
        cin >> b[i];
        cout<<"Enter the grade you earned for the course \n";
        cout<<"(A= 4, B= 3, C= 2, D= 1)              :";
        cin>>c[i];
        cout <<"-------------------------------------------- \n"; 
        average_GPA = b[i] * c[i]; 
        a1 = average_GPA + a1;total_credits =[i] +  total_credits;
    }

    Cummalative_GPA = a1 / total_credits; 
    cout<< "Your cummalative GPA for the semester is a \n" <<"  (" << Cummalative_GPA <<")\n";

    return (0);
}

I have to chnage alot of that coding, because that's what i found in my book for a different GPA calculator... i started fixing the 1st couple of rows.

I was reading the GPA score thread but it didn't help me any. i am suppose to be making a program that should prompt the user to enter up to 30 GPA's which are stored in a single dimension array. each time the user enters a GPA they should have the option to calculate the current GPA's or add another..
Help Please!!

So the user enters grades and you calculate a GPA from the grades (A, B, C, D, F), or the user enters the student's GPA itself and there is more than one student and you calculate an average GPA for the class? It's not clear what is to be "calculated" if the GPA itself is what is entered.


sorry...
this is crazy they would give me a programming class before an introduction to programming..
i can show you what i have, but i actually need the whole thing..lol
this is not my forte' i make web pages in Dreamweaver , with no coding needed. lol

1. # include <iostream>
2. using namespace std;
3.
4. int main ()
5. {
6. float fAverages[31], c [100], a, a1, GPA_scores, total_scores, Cummalative_GPA;
7.
8. cout <<"Enter GPA scores: ";
9. cin>>a;
10. cout <<"-------------------------------------------- \n";
11. a1=0; total_scores=30;
12.
13. for (int i=0; i<=a;i++)
14. {
15. cout <<"calculate Gpa’s "<< i <<": " ;
16. cin >> b;
17. cout<<"Enter the grade you earned for the course \n";
18. cout<<"(A= 4, B= 3, C= 2, D= 1) :";
19. cin>>c;
20. cout <<"-------------------------------------------- \n";
21. average_GPA = b * c; a1 = average_GPA + a1;total_credits = b + total_credits;
22. }
23.
24.
25. Cummalative_GPA = a1 / total_credits;
26. cout<< "Your cummalative GPA for the semester is a \n" <<" (" << Cummalative_GPA <<")\n";
27.
28. return (0);
29.
30.
31. }

If this is an example from Daniweb, you can click "Toggle Plain Text", then do a copy and paste, which makes those line numbers disappear. To add code tags to YOUR post, do this:

[code=cplusplus] // paste code here

[/code]

The example above has the user entering numbers (4, 3, 2, 1, 0 for A, B, C, D, F) rather than the GPA itself. As i mentioned earlier, make sure you understand exactly what the user's input is supposed to be. And is there one student or more than one student? I imagine there is one student and you are to enter letter grades or the numbers 0 through 4 and store them in a character or integer array, then create a GPA from that array after the user is finished inputting the data, but that's just a guess. Please clarify.

The user is only entering GPA's itself. up to 30 of them and they have to have an option to either enter more or calculate what they have every time they enter a GPA.
eg. GPA 3.5
gpa 2.5 and so on..
there are no grades to calculate a student's gpa because they already have them. it's kind of like calculating all the gpa's in a year i guess. it's just what was written in the directions for me to do.

The user is only entering GPA's itself. up to 30 of them and they have to have an option to either enter more or calculate what they have every time they enter a GPA.
eg. GPA 3.5
gpa 2.5 and so on..
there are no grades to calculate a student's gpa because they already have them. it's kind of like calculating all the gpa's in a year i guess. it's just what was written in the directions for me to do.

O.K., you have at least two parts to the program then. One, getting the data from the user and sticking it in the array. Two, figuring out the average GPA from the information in the array. Tackle them separately. You have a maximum of thirty students, so define your GPA array that size. You need to ask the user each time whether he/she wants to enter another GPA or whether he/she is done. So you're going to have to change that for-loop that you have because currently it goes through thirty people and doesn't give you a chance to bail out. So get the data into the array, then after the user is done, probably start another loop where you get the sum of the array elements. Then calculate an average from that and display it.

I fixed up your program in your post #3 this time so that it uses code tags correctly as previously explained. In futures posts please do two things

1) Use spaces instead of tabs because tabs look awful. I'll bet the editor that you use has an option to use either tabs or spaces. Set it to spaces and your program will look pretty with any editor or web site where you wish to post it.

2) use code tags.

This article has been dead for over six months. Start a new discussion instead.