China Naming Network - Auspicious day query - C language program judges score
C language program judges score
# include " stdio . h " const int LEN = 30,M= 100,N = 100; Typedef structure {int num// lottery number charname [len]; //Name floating score; //Score} players; Player player [m]; //singer information inta [m] [n]; //Judge's scoring information int m, n; //Number of singers and judges//Enter the singer information and the judge's rating information void input(void){ int i, j; Printf ("Number of singers:"); scanf("%d ",& ampm); Printf ("Number of judges:"); scanf("%d ",& ampn); for(I = 0; I & ltm;; i++) { players[i]。 num = I+ 1; Printf ("the name of the %d singer:", I+1); Scanf("%d ",& Player [me]. Name); Printf ("Judge's rating for %d singer:", I+1); for(j = 0; j & ltn; j++) { scanf("%d ",& ampa[I][j]); }}}//Average (remove a highest score, remove a lowest score, and find the average of the remaining n-2 scores Void Calculate (void) {float max, minint i, j; for(I = 0; I & ltm;; i++) { max=min=players[i]。 Score = a [I] [0]; for(j = 1; j & ltn; j++) { players[i]。 score+= a[I][j]; if(max & lt; a[I][j]){ max = a[I][j]; } if(min & gt; a[I][j]){ min = a[I][j]; } } if(n & gt; 2) {Player [me]. Score = (player [me]. score-max-min)/(n-2); } else if(n & gt; 0) { players[i]。 score/= n; }}}//Sort the scores of each player by bubble method//If you use quick sorting or heap sorting, just rewrite this paragraph. void sort(void){ int i,j; for(I = 0; I<m-1; i++){ for(j = m- 1; J> me; J-) {if (player [j]. Score & gt players [j- 1]. Score) {player tmptmp = players [j]; Player [j]= player [j-1]; Player [j-1] = tmp; }}}}//Display all original data void show_origin(void){ int i, j; printf(" \ n "); for(I = 0; I & ltm;; I++) {printf ("lottery number: %d", player [i]. num); ; Printf ("name: %d", player [i]. Name); Printf ("Judges' Rating:"); for(j = 0; j & ltn; j++) { printf("%d ",a[I][j]); } printf(" \ n "); }}//Displays all the singer information Voidshow _ player (void) {int i; printf(" \ n "); for(I = 0; I & ltm;; I++) {printf ("lottery number: %d", player [i]. num); Printf ("name: %d", player [i]. Name); Printf ("score: %f\n", player [i]. Score); }}//Displays the information of the award-winning singer int main() {input (); show _ origin(); Calculate (); show _ player(); sort(); Returns 0; }