Mean and Variance

I have to write a program in which it is to compute the mean and standard deviation from a set of 10 random scores between 1 and 20. The C++ program should generate a set of scores randomly and then, compute the mean and standard deviation from such a set of scores.
I am just having a hard time knowing how to start this!
-Thanks
Then tell us your idea!
Start by blocking out what you need to do:

1
2
3
generate a set of 10 random scores between 1 and 20;
compute the mean;  // from such a set of scores
and standard deviation; // from such a set of scores 


then replace the description with usable c++ code:

1
2
3
4
5
6
7
8
generate a set; //means a loop to create 10 random numbers
for( int i = 0; . . .) 
{ create a random number;
sum it to a total and count; 
// or store it in an array }
etc.
// the mean and stdev can be calculated per generated number, or by a process after an array is created
//after the mean and stdev have been calculated, cout << them 
Last edited on
Topic archived. No new replies allowed.