i have created the following to display the numbers entered by a user in an array can anybody tell me how i can find out the average of the ten integer numbers entered and display the total. i know ill have to change the variables to floats to accomodate decimal points. im a begginer
Code:
#include <iostream.h>
#define MAX 10
main()
{
int number[MAX];
int index;
for (index = 0; index < MAX; index++)
{
cout <<"Please enter a number ";
cin >> number[index];
}
for (index = 0; index < MAX; index++)
{
cout <<endl;
cout << "The contents of the array is as follows";
cout << (index + 1) << " is ";
cout << number[index];
}
cout << endl;
return(0);
}
[edit]Code Tags added by Hammer.