your supposed to create an array of intigers and pass it to the average function, and need to pass the size(so that you know how many times to loop). In the loop in your Average function add all the values to a temporary value, then divide by the count input-ed to the function.
//returns the average
int average(int Values[],int Size){
//perhaps declare a temporary value here
for(int i=0;i<Size;i++){
//add all the values up and store in a temporary value
}
//here divide by Size and return that as the average
}
this
if(values[size]>output){
cout << "The values above average are: " << output << endl;
}
should be replaced with something like:
for(int i=0;i<size;i++){
if(values[i]>output){
cout << "The values above average are: " << values[i] << endl;
}
}
2
solved Array’s in function confusion C++ [closed]