The Code-Bin
Links
Home
Add your code!
All Listings
About
Latest Entry
Featured Scripts
Author's Website
Latest Entries
FFMPEG Thumbnail Scr...
PHP, 0.8KB
Jul. 29, 10:24pm
John
Z80 Assembler, 190 bytes
Feb. 17, 3:36am
John
Z80 Assembler, 176 bytes
Sep. 13, 2:19am
John
Z80 Assembler, 77 bytes
Sep. 13, 2:18am
John
Z80 Assembler, 209 bytes
Sep. 13, 2:17am
untitled C Code
Posted by: Last night | March 19, 2011 @ 12:29am
C Code
[
Download
]
//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; }
Syntax Highlighting
[
Open in new window
]
Author Comments
none
Rating
4.51 / 8
171 Votes
http://codebin.yi.org/1175
page generated in 0.00 seconds