Code:
#include <stdio.h>
#include <math.h>
int main() {
int num_shows, num_contestants, num_judges, sd_threshold;
double average;
// Open the text file.
FILE* ifp = fopen("ucfidol.txt", "r");
//scanning info from text file
fscanf(ifp, "%d", &num_shows);
fscanf(ifp, "%d%d%d", &num_contestants, &num_judges, &sd_threshold);
//declaring array size by text file
int score[num_contestants][num_judges];
int i, j;
//populates 2d array with numbers from text file
for (i=0; i<num_judges; i++) {
for (j=0; j<num_contestants; j++)
fscanf(ifp, "%d", &score[i][j]);
printf("%d",score[i][j]);
//printf("%d",score[num_c]); //testing the file input
printf(" ");
}
// Close the file.
fclose(ifp);
system("PAUSE");
return 0;
}
Attachment 10432