/*----------------------------------------------------------------------*/
/*                        AverageArray.cpp                              */
/* Authored By : H.P.Kasmaei                                            */
/* Last Update : April 13, 2009                                         */
/* http://www.hpkclasses.ir/                                            */
/*----------------------------------------------------------------------*/

#include <iostream.h>

#define MAX_GRADE 100
#define STUDENTS  10

float grades[STUDENTS];

int idx;
float total = 0;           /* used for average */

main() {
   for( idx=0;idx< STUDENTS;idx++){
      cout << "Enter Person " << idx+1 << "\'s grade: ";
      cin >> grades[idx];

      while ( grades[idx] > MAX_GRADE ) {
	  cout << "\nThe highest grade possible is" << MAX_GRADE;
          cout << "\nEnter correct grade: ";
          cin >> grades[idx];
          }

      total += grades[idx];
      }

   cout << "\n\nThe average score is " << total / STUDENTS;

   return (0);
}


