I have been working on this code for two weeks. I think I have it down to the last couple of lines ie funtion to call from main. But I just cant seem to get it.. Please help, due at midnight..ANd this is my first class so be gentle. :), The code needs to allow user to enter 10 numbers in double format, store the numbers in an array, Creat and use a function to calculate the average of the numbers in the array, Out put the average.
#include <iostream>
using namespace std;
const int NumScores = 10; // Give a descriptive variable name
int main ()
{
int k;
//int sum;
int score[NumScores]; // Notice I'm using the constant? Give names to numbers.
for (int k=0; k<NumScores; k++) //loop that inputs arrays data
{
cout <<"Enter score for 10 test:"<< (k+1) <<endl;
cin >> score[k];
}
for (int k=0; k<NumScores; k++)
{
cout<<"score for test: "<<(k+1)<<" is "<<score[k]<<endl;
}
int sum = 0;
for(int k=0; k<NumScores; k++);
{
//sum = sum + NumScores[k];
}