//Assignment 4
//Kyle Weeks
//3/17/11
#include <stdio.h>
#include <math.h>
int main(){
//Load point
FILE *ifp;
//open file
ifp = fopen("/Users/kylew/Documents/example/ucfidol2.txt", "r");
//variables
double avg=0;
int h, i, j;
int max_con, max_judge, dev_chk, shows;
double avgj[5];
int con_score[max_con][max_judge];
//double judg_avg[max_judge];
fscanf(ifp, "%d", &shows);
for (h=0; h<shows; h++) {
fscanf(ifp, "%d%d%d", &max_con, &max_judge, &dev_chk);
for (i=0; i<max_con; i++) {
for (j=0; j<max_judge; j++) {
fscanf(ifp, "%d",&con_score[i][j]);
avg += con_score[i][j];
avgj[j] += con_score[i][j];
//printf("%d\n",con_score[i][j]);
}
avg = avg/max_judge;
printf("Average for contestant %d = %lf\n", i
+1, avg
);
avg=0;
}
for (j=0; j<max_con; j++) {
//printf("%d\n", max_con);
//printf("%lf\n", avgj[j]);
avgj[j] = avgj[j]/max_con;
printf("Average for judge %d = %lf\n", j
+1, avgj
[j
]);
}
}
return 0;
}