I'm having a problem getting the number of integers greater than the average in my array to display. I keep getting "You have 1 number greater than the average when there are 5 that are greater. Pls help!!!
This is the code I've devolped so far:
#include <iostream>
using namespace std;
int main(){
const int SIZE = 10;
int myArr[SIZE];
double myAvg;
int myCount = 0;
cout<<"Give me 10 whole numbers: "<<endl;
for(int i = 0; i<SIZE; i++){
cin>>myArr[i];
}
myAvg = (myArr[0] + myArr[1] + myArr[2] + myArr[3] + myArr[4] + myArr[5] + myArr[6] + myArr[7] + myArr[8] + myArr[9]) / 10;
if(myAvg < myArr[SIZE]){
}
myCount++;
cout<<"You have "<<myCount<<" number(s) greater than the average"<<endl;
system("pause");
return 0;
}