Wall for 施智翔

#include <stdio.h>
#include<stdlib.h>
#include<string.h>

main() {

    FILE *fp;
    char buff[255],score[60];
    int grade=0;
    float x=0;
    fp = fopen("grade.txt", "r");
    printf("Sorting by average:\n");
    while (!feof (fp)){
        fscanf(fp, "%s", buff);
        printf("%s", buff );
        int i;
        for (i=1;i<=3;i++){
            fscanf(fp, "%d", &grade);
            printf(" %d",grade);
            x=x+grade;
        }
        x=x/3;
        printf(" %.1f",x);
        fscanf(x,"%s",score);
        x=0;
        printf("\n");
    }
    fclose(fp);

}

Feb 21, 2019 by 施智翔
12,783 questions
183,443 answers
172,219 comments
4,824 users