/// july17ex1.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "stdlib.h"
#include "time.h"
#define num_stu 15


int main(int argc, char* argv[])
{
   int which, hi_stu, lo_stu;
   float gpa, hi_gpa=-99.9, lo_gpa=100.0, tot_gpa=0.0;
   srand(time(NULL));


   for (which=1; which<= num_stu; which++){

	   gpa = float (rand() % 401) / 100;
	   tot_gpa = tot_gpa + gpa;

	   if (gpa > hi_gpa)  {
                hi_gpa = gpa;
				hi_stu = which;
	   } /* end if gpa */

	   if (gpa < lo_gpa)  {
                lo_gpa = gpa;
				lo_stu = which;
	   } /* end if gpa */

	   printf("Student %2d had gpa of %4.2f\n", which, gpa);


   }  /*end for which  */


   printf("The average gpa was %4.2f\n", tot_gpa/num_stu );
   printf("The highest gpa was %4.2f belonging to student num %d\n",
	         hi_gpa, hi_stu);

   printf("The lowest gpa was %4.2f belonging to student num %d\n",
	         lo_gpa, lo_stu);

	return 0;
}