loops, arrays

So I am trying to save 15 user entered numbers into an array (to eventually find the average of them), Im having some real trouble. Here is what ive got so far:

int main()
{
float user[15],a;
string end = "";

cout << "This program will find the average of up to 15 numbers. " << endl;
cout << "You can stop at any time, by typing 'done': ";
cin >> user[0];
for (int i = 0; i < 14; i++) {
cout << "Please enter another number:";
cin >> user[i];
a = i;
}
cout << a << endl;
return 0;
}

Any help would be appreciated
try go go like

int total=0;
const int sizeofarray = 15;
int numbers[sizeofarray];
for (int i = 0; i<sizeofarray; i++){
cin>>numbers[i];
total+=numbers[i];
}
cout<<(float)total/sizeofarray;
Wow, thank you!
Topic archived. No new replies allowed.