Im supposed to create a program that will read 10 floating pt numbers into an array of 10 double. The program is supposed to quit on non numeric input, which i have succeeded in doing, and also the program is supposed to take an average of all of the numbers and report how many of the 10 numbers entered are above average (this is the part that im having trouble with). With the code shown below, the program takes an average but it doesnt report how many numbers are above average. Please help me.
#include <iostream>
#include <cctype>
int main()
{
using namespace std;
double input[10];
double total = 0;
double avg = 0;
int count = 0;
cout << "Enter the numbers (up to ten) then press enter, make sure each value is floating point\n";
for (int i = 0; 10 > i; i++ )
{
if (cin.fail() == false)
{
cin >> input[i];
}
else
{
break;
}
total += input[i];
}
avg = total / 10;
cout << "Average is: " << avg <<endl;
for ( int e = 0; input[e] > avg; e++)
count++;
cout << count << " Numbers are above average\n";
cin.get();
cin.get();
cin.get();
return 0;
}