Having trouble finding the average

I'm nearly done finishing my code but the average is wrong.It keeps selecting 77 the last number in line for it's average here's my code.I'm not sure what function i need to put in for the average.
1
2
3
4
5
6
7
8
9
10
11
12
int ArrayClass::average(void)
{
int average = 0;

             for (int i = 0; i < theArraySize; i++)
            {
             average=+ theArray[i];
            }
            return average;

}

Here's the number list i have
5, 10, 22, 1, 12, 54, 4, 99, 34, 77
You typed += in the opposite way.
You should divide average by theArraySize when returning it
thanks that helped out alot.
Topic archived. No new replies allowed.