I am receiving a C4700 warning. The C++ program I am building, is suppose to allow user to enter (50)numbers, store in array, calculate the average of numbers in the array, and output the calculate sum and average. It states(succeeded) after compiling, but it will not transverse the array.
//
// Final project Template
// Author: Masquerade1986
// Date Written: April 27, 2011
//
#include <iostream>
using namespace std;
double avg_num (double num[], int i); //Function prototype
int main ()
{
double Average;
double num[50];
int i;
const int terminal_val = -777;
cout << "Enter any 50 positive numbers: " << endl;
for (i=0; i < 50; i++) //For Loop to load array
{
cin >> num[i]; //Populate array
}
Average = avg_num (num,i); // Function Call
//cout << "The total of the numbers in the array is: " << tot_num << endl;
cout << endl;
cout << "The average of the " << i << " numbers in the array is: " << Average<< endl;
return (0);
}
/****************************************************************************/
/* Function to calculate the average of the 10 numbers */
/****************************************************************************/
double avg_num (double num[], int i) //Function Definition
{
double avg_of_num,tot_num;
int j;
for (j=0; j < 50; j++) // For Loop to traverse array and calculate average