so im calculating the avergae of 5 numbers ive put in the array but when i compile i get a very large number
heres my code
#include <iostream>
using namespace std;
int calcAverage()
{
int sum=0;
int average;
int TESTVALS[5] = {2, 18, 1, 27, 16};
for(int i = 1; i < 5; i++)
sum+= TESTVALS[i];
average= sum/5;
cout<<"average";
}
int main()
{
cout << "The average value" << calcAverage() << endl;
system("pause");
return 0;
}
and yes i need the calcAverage as a prototype. i can do it w.o the protoype but i am going to need it later on