help please!

++++nevermind, all figured out+++++


delete
Last edited on
Averages are not calculated in loops. Sums are calculated in loops.
ok will get back to u
Last edited on
-
Last edited on
Try to first write a small program which takes in 10 values from the user and outputs the average. If you can get that to work, you will know how to fix your program ;)
4 values instead of 10 :) but are u saying my output has to go above my ifs and fors?


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <iostream>
#include <iomanip>

using namespace std;

int main()

{

float programgrade1, programgrade2, programgrade3,programgrade4,avg;

cout<<"Enter the grade for Program ";
        cin>>programgrade1;
		
cout<<"Enter the grade for Program ";
        cin>>programgrade2;

cout<<"Enter the grade for Program ";
        cin>>programgrade3;
		
cout<<"Enter the grade for Program ";
        cin>>programgrade4;
		
avg=(programgrade1+programgrade2+programgrade3+programgrade4)/4;


cout<<"AVG:  "<<avg;

return 0;

}
For the 10-value-average program, use a loop. Hint: other than the loop variable, you will only have one variable named sum.
-
Last edited on
THe sum should be calculated during the loop. The average should be calculated after the loop. Your code in your OP does not calculate the sum at all, and it tries to magically calculate the average inside the loop.
-
Last edited on
Where are you pulling these equations from? Taking the average of a data set is something you learn in elementary school - if you need a refreshed you can use Google. There is no 100 involved in the calculation.
these equations are from my assisgnment in school. in may not look like you are helping me but you are greatly. i have successfully gotten the program and test average working. and am figuring out the total average now which should be the easiest. sorry yea the equations fooled me for awhile too because they make no sense.
Ah, programming classes are notorious for misinformation. I'm sorry you have to deal with that.

What are you currently stuck on? Can you post your current code?
I just pmed you a thank you!

I currently have the program/quiz/test all outputing 100% what they are suppose too.
I'm glad you were able to figure it out, but it's rude to delete your post content. When other people who have the same problem come here it will be a waste of time for them. You're basically saying "only I deserve the answer to this problem", which is quite selfish even if you don't realize. In the future don't remove your post content like this.
ahhh ok sorry im new here still learning the ropes
Topic archived. No new replies allowed.