急求!希望这题做了能给明日考试一些帮助 (C语言写)

急求!希望这题做了能给明天考试一些帮助 (C语言写)
要求:读入一系列两元组数据<姓名,成绩>,生成一个排序的五元组<姓名,总分,平均分,最低分,最高分>,并将排序结果按照姓名的降序生成到文件。

文件举例:
Input files: In_3.txt
<aaa,77>
<bbb,82>
<ccc.72>
<aaa,83>
<bbb,95>

Output files: [Your Student No.]_3_out.txt
<ccc,72,72,72,72>
<bbb,177,88.5.5,82,95>
<aaa,160,80,77,83>

------解决方案--------------------
1. 读文件
2. 以姓名为key作查找和计算
3. 排序
4. 写文件

你是哪部分不会呢?
------解决方案--------------------
while循环用fgets 读入一行line
sscanf(line,"%[^,],%[^,],%s",name,number,tmp); //tmp没用,防止坏数据溢出
然后数据就出来了,放到数组里处理输出就好了
------解决方案--------------------
//读入一系列两元组数据<姓名,成绩>,生成一个排序的五元组<姓名,总分,平均分,最低分,最高分>,并将排序结果按照姓名的降序生成到文件。
//
//文件举例:
//Input files: In_3.txt
//<aaa,77>
//<bbb,82>
//<ccc,72>
//<aaa,83>
//<bbb,95>
//
//Output files: [Your Student No.]_3_out.txt
//<ccc,72,72,72,72>
//<bbb,177,88.5,82,95>
//<aaa,160,80,77,83>
#include <stdio.h>
#include <string.h>
#define MYNO "0001"
#define MAXL 1000
static struct S {
    char nam[20];
    double tsc;
    double asc;
    double lsc;
    double hsc;
    int num;
} s[MAXL],t;
char ln[80];
char nam[20];
double sco;
FILE *f;
int n,i,h,j;
char c;
int main() {
    f=fopen("In_3.txt","r");
    if (f==NULL) {
        printf("Can not open file In_3.txt\n");
        return 1;
    }
    n=0;
    h=0;
    while (1) {
        if (NULL==fgets(ln,80,f)) break;
        h++;
        if (3==sscanf(ln,"<%19[^,],%lf%c",nam,&sco,&c)) {
            if (c!='>') printf("line %d formar error:%s",h,ln);
            else {
                for (i=0;i<n;i++) {
                    if (0==strcmp(nam,s[i].nam)) break;
                }
                if (i<n) {
                    s[i].tsc+=sco;
                    if (s[i].lsc>sco) s[i].lsc=sco;
                    if (s[i].hsc<sco) s[i].hsc=sco;
                    s[i].num++;
                } else {
                    strcpy(s[n].nam,nam);
                    s[n].tsc=sco;
                    s[n].lsc=sco;
                    s[n].hsc=sco;
                    s[n].num=1;
                    n++;
                    if (n>=MAXL) {
                        printf("Too many students(>%d)!\n",MAXL);