Esempio n. 1
0
int main( void )
{
	int count=0;
	float avg=0;
	float std=0;
	float grades[MAXLINE];
	int studID[MAXLINE];

	
	M_ReadGrades("grades.dat",&count,grades,studID);

	M_AvgGrade(grades,count,&avg);

	M_std(grades,count,&std);


	int a=3;
	printf("%i students participated in the exam\n",count);
	printf("Student %i scored a %f\n",studID[a],grades[a]);
	printf("The average grade was %f\n",avg);
	printf("With a standard deviation of %f\n",std);
	
	//WriteResults(count,avg);
	
	
	return 0;
}
Esempio n. 2
0
int main( void )
{
	int count=0;			//Number of participated students
	float avg=0;			//Average of the scores
	float std=0;			//Standard deviation of the scores
	float max=-1;			//Lowest grade
	float min=11;			//Highest grade
	float grades[MAXLINE];	//List with scores
	int studID[MAXLINE];	//List with student identification numbers

	M_ReadGrades("grades.dat",&count,grades,studID); // 	Intitializes grades, studID and count from input file 

	M_AvgGrade(&count,grades,&avg); // Calculates avg

	M_std(&count,grades,&avg,&std); // Calculates std

	M_extrema(&count,grades,&max,&min); // Calculates max and min

	M_WriteResults("processed_results.dat",&count,&avg,&std,&max,&min,grades,studID); // Writes results to output file
	
	return 0;
}