Using a function to find the mean

I am working on a program in my first c++ class.
I have been doing ok so far I guess, but I cant figure out how to get this program to work. I keep getting the following errors on line 6
expected unqualified-id before '{' token
expected `,' or `;' before '{' token
Here's the code
Can anyone help? I dont understand my error

#include <iostream>
#include <cmath>
using namespace std;

int average (int num1, int num2, int num3, int num4, int num5);
{
int sum = (num1 + num2 + num3 + num4 + num5);
int result;
result = (sum/5)
return result;
}
int main ()
{
cout << "Enter 1st integer: " << endl;
int a;
cin >> a;
cout << "Enter 2nd integer: " << endl;
int b;
cin >> b;
cout << "Enter 3rd integer: " << endl;
int c ;
cin >> c;
cout << "Enter 4th integer: " << endl;
int d;
cin >> d;
cout << "Enter 5th integer: " << endl;
int e;
cin >> e;

average (a, b, c, d, e);

system("pause");
return 0;
}
int average (int num1, int num2, int num3, int num4, int num5);
remove the ;

result = (sum/5)
add a ;
Last edited on
Thank you so much!
Topic archived. No new replies allowed.