HELLO,
Any idea how to compute the averages for 6 values that have been computed from a for loop,
I mean once the for loop finishes it prints me six different values classified into 3 groups as shown down:
group1 has value1
groupe2 has value2, value3, value3
group3 has value5, value6
I want to find the average for each group.
considering the number of values in each group might change.
this is the code for finding the values:
the final result like this:
cout<<"average of group1 is"<<
cout<<"average of group2 is"<<
cout<<"average of group3 is"<<
:) ?
Any idea how to compute the averages for 6 values that have been computed from a for loop,
I mean once the for loop finishes it prints me six different values classified into 3 groups as shown down:
group1 has value1
groupe2 has value2, value3, value3
group3 has value5, value6
I want to find the average for each group.
considering the number of values in each group might change.
this is the code for finding the values:
Code:
for (int i=0; i<n; i++)
{
if (value < 25)
{
group1++;
class = "group1";
}
else if (value > 50)
{
groupe3++;
class = "groupe3";
}
else
{
group2++;
class = "group2";
}
cout<<"average of group1 is"<<
cout<<"average of group2 is"<<
cout<<"average of group3 is"<<
:) ?
Comment