OK, well I can't write the code for you, especially because this is an academic assignment.
All I can do is give you some pointers, and you have to work it out yourself.
This is EXACTLY what you need to do (but I've written it in psuedo-code)
1. Sum As Integer = 0
2. For each item in array
2. a) Sum = Sum + item
3. MeanAverage = Sum / numberUsed
Perhaps, you can't put that into code yourself, so you need to learn. Here's a simple example of adding a number:
CODE
int a = 3; // make variable, a, set it to 3
int b = 5; // ditto
b += 3; // add 3 to b
b += a; // add a to b
cout << b; // send b to console
b will start as 5. Then it will change to 8 (5+3). Then it will change to 11 (8+3). Then it will be pushed to the console (i.e. printed/displayed)
If you want to do it multiple time, you must use a for loop. This loop below will count from 0 to 4 (i.e. the code inside will be run 5 times)
CODE
int n = 0; // create integer, n, set it to 0
for(int i = 0; i < 5; i++) {
n+=2;
}
cout << n;
This time 10 will be pushed to the console. Because n starts at 0, and adding 2 to it 5 times makes it ten.
If you need to access an array index:
CODE
int arr[5]; // this creates an array with 5 elements (from 0 to 4)
int i = 3; // create an int, set it's value to 3.
arr[i] = 34; // access array element 3 (the 4th element) and set it to 34
cout << arr[3]; // send "34" to console.
If you read this post, and understand it, you have more than enough information to write your mean calculation routine.
All you need to do is make a for loop. Access the array using i, add each value in the array to sum, divide sum by the number of values. All code examples I gave you have one of the elements that you need.
This post has been edited by Nayana: 17 Jan, 2008 - 11:04 PM