I'm currently taking the introduction to C++ class. I'm currently ahead of my class so the teacher refuses to answer my questions -_-. I've been reading through my book and looking through the web but I can't understand what my mistake is, can anyone give me hints as to what my mistake is?

Also, I know the code is sort of a mess, I've been messing around with it alot to try and figure out the mistake so there are a few variables and instructions that aren't useful, it's just that I couldn't get my function that calculates the average to work so I just programmed the instructions into the main.

I marked the line with the error with ==><== error here.

Code:

#include <iostream>
using namespace std;
int carre(int x);
double average(int a[]);
int main()
{
int n,
i,
m,
entier[5];
double moyenne,
moyenne_carre,
sum = 0,
sum_carre = 0;
char check;
do {
cout << "\nVeuillez entrer 5 valeures entieres : " <<endl;
for ( m = 0 ; m <= 4 ; m++ )
cin >> entier[m];
/*for ( m = 0 ; m <= 4 ; m++)
sum += entier[m];
moyenne = sum / 5;*/
cout << "La moyenne des chiffres est :";
for ( n = 0 ; n <= 4 ; n++ )
===> cout << average(entier[n]) << " "; <=== error here
/*cout << "Les valeures au carre sont: ";
for ( i = 0 ; i <= 4 ; i++ )
cout << carre(entier[i]) << " ";
for ( m = 0 ; m <= 4 ; m++ )
sum_carre += carre(entier[m]);
moyenne_carre = sum_carre / 5;
cout << "La moyenne des chiffres au carre est:" << moyenne_carre << endl;
*/
cout << "\nEncore? (y/n) :";
cin >> check;
} while (check == 'y');
cin.sync();
cin.get();
}
int carre(int x)
{
return x * x;
}
double average(int a[])
{
int avg = 0, sum = 0, n, i = 0;
for (n = 0 ; n <= 4 ; n++)
{
sum += a[n];
i=i++;
}
avg = sum/i;
return avg;
}