关于学生成绩管理系统的问题

#include
#include
#include
typedef struct date
{
    int year;
    int month;
    int day;
}DATE;
typedef struct stu
{
    long stuID;     //学号
    char stuname[10];    //名字
    char stusex;     //性别
    DATE birthday;   //生日
    int score[4];    //4科分数
    float aver;      //平均分
}STU;
typedef struct node
{
    STU stu;
    struct node* next;   //指向下一个节点的指针
}NODE;
NODE* head = NULL;  //定义头指针
struct node* creatnode();
void start();
void inputstudent(STU stu[], int n, int m);   //录入学生信息
void totalscore(STU stu[], int n);   //计算学生总分及排名并能根据姓名查询学生成绩及排名
void savestudent();    //保存学生信息
void scoreline_uptodown(STU stu[], int n);   //按每个学生的总分由高到底
#define N 30
int main()
{
    NODE* list = creatnode();    
    if (head == NULL)
    {
        head = list;
    }
    STU stu[N];
    int n;
    int m = 4;
    printf("输入学生人数:");
    scanf_s("%d", &n);
    while (1)
    {
        start();
        char ch = _getch();
        switch (ch)
        {
        case '1':  //录入学生信息
            inputstudent(stu,n,m);
            break;
        case '2':  //保存学生信息
            void savestudent();
            break;
        case '3':  //按总分由高到低排出名次
            break;
        case '4':  //按总分由低到高排出名次
            break;
        case '5':  //按学号由小到大排出成绩表
            break;
        case '6':  //按姓名字典顺序排序排出成绩表
            break;
        case '7':  //计算学生总分及排名并能根据姓名查询学生成绩及排名
            totalscore(stu,n);
            break;
        case '8':  //计算学生总分及排名并能根据学号查询学生成绩及排名
            break;
        case '9':  //退出系统
            break;
        }
    }
    return 0;
}
void start()
{
        printf("*****************************************\n");
        printf("欢迎使用学生成绩管理系统        *\n");
        printf("*1.录入学生信息                *\n");
        printf("*2.打印学生信息                *\n");
        printf("*3.保存学生信息                *\n");
        printf("*4.读取学生信息                *\n");
        printf("*5.按总分由高到低排出名次        *\n");
        printf("*6.按总分由低到高排出名次        *\n");
        printf("*7.按学号由小到大排出成绩表        *\n");
        printf("*8.按姓名字典顺序排序排出成绩表        *\n");
        printf("*9.根据学号查询学生成绩及排名        *\n");
        printf("*0.根据姓名查询学生成绩及排名        *\n");
        printf("*00退出系统                        *\n");
        printf("*****************************************\n");
}
void inputstudent(STU stu[], int n, int m)
{
    int i, j;
    NODE* newnode = (NODE*)malloc(sizeof(node)); //创建一个新结点来作头结点,使newnode这个指针可以通过->来当作结构体变量来用
    newnode->next = NULL;
    if (head == NULL)
    {
        head = newnode;
    }
    else
    {
        newnode->next = head;
        head = newnode; //newnode = head;  修改
    }
    for ( i = 0; i < n; i++)
    {
        printf("学号:");
        scanf_s("%ld", &newnode->stu.stuID);
        printf("姓名:");
        scanf_s("%s", newnode->stu.stuname, 10); //修改
        printf("性别:");
        scanf_s(" %c", &newnode->stu.stusex, 1);  //修改
        printf("年:");
        scanf_s("%d", &newnode->stu.birthday.year);
        printf("月:");
        scanf_s("%d", &newnode->stu.birthday.month);
        printf("日:");
        scanf_s("%d", &newnode->stu.birthday.day);
        printf("4科成绩:");
        for ( j = 0; j < 4; j++)
        {
            scanf_s("%d", &stu[i].score[j]);
        }
    }
}
void totalscore(STU stu[], int n)   //计算学生总分及排名并能根据姓名查询学生成绩及排名
{
    int i, j, arr[30] = { 1 };
    int sum[30];
    for (i = 0; i < 4; i++)
    {
        sum[i] = 0;
        for (j = 0; j < 4; j++)
        {
            sum[i] = sum[i] + stu[i].score[j];
        }
    }
    for (i = 0; i < n; i++)
    {
        int c;
        c = sum[i];
        sum[i] = sum[0];
        sum[0] = c;
        for (j = 0; j < n - 1; j++)
        {
            if (sum[i] < sum[j + 1])
                arr[i] = arr[i] + 1;
        }
    }
    while(1)
    {
        printf("输入所要查询的学生姓名:");
        char nameput[10];
        scanf_s("%s", nameput);
        for (j = 0; j < n; j++)
        {
            for (i = 0; i < 200; i++)
            {
                if (nameput[i] != stu[j].stuname[i])
                    break;
                else
                    printf("总分:%d 名次:%d", sum[j],arr[j]);
            }
        }
    }
} 
void savestudent()    //保存学生信息
{
    FILE* pf = fopen("ppp.txt", "w"); //创建并打开文件
    if (pf == NULL) //判断打开文件是否失败
    {
        printf("err!");
        return;
    }
    NODE* p = head;
    while (p!=NULL)
    {
        fwrite(&p->stu, 1, sizeof(STU), pf);
        p = p->next;
    }
    fclose(pf);
    printf("数据保存成功\n");
    system("pluse"); //暂停
    system("cls");  //清屏
}
void scoreline_uptodown(STU stu, int n)
{
    int i;
    for (i = 0; i < n; i++)
    {
        
    }
}

代码错误,请问如何修改?

可以参考一下,具体还得直接调

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

typedef struct date {
    int year;
    int month;
    int day;
} DATE;

typedef struct stu {
    long stuID;         // 学号
    char stuname[11];   // 名字,需留出一个字符存放字符串结束符 '\0'
    char stusex;        // 性别
    DATE birthday;      // 生日
    int score[4];       // 4科分数
    float aver;         // 平均分
    int total_score;    // 总分
} STU;

typedef struct node {
    STU stu;
    struct node* next;  // 指向下一个节点的指针
} NODE;

NODE* head = NULL;       // 定义头指针
void start(void);        // 显示菜单
NODE* creatnode(void);   // 创建新节点
void inputstudent(int n, int m);       // 录入学生信息
void printstudent(void);               // 打印学生信息
void savestudent(void);                // 保存学生信息
void readstudent(void);                 // 读取学生信息
void scoreline_uptodown(int n);         // 按总分由高到低排出名次
void scoreline_downtoup(int n);         // 按总分由低到高排出名次
void idline_uptodown(int n);            // 按学号由小到大排出成绩表
void nameline_dictorder(int n);         // 按姓名字典顺序排序排出成绩表
void totalscore(int n);                 // 计算学生总分及排名并能根据姓名查询学生成绩及排名
void idquery(int n);                    // 根据学号查询学生成绩及排名
void namequery(int n);                  // 根据姓名查询学生成绩及排名

#define N 30

int main() {
    int n;
    int m = 4;
    printf("输入学生人数:");
    scanf("%d", &n);

    while (1) {
        start();
        char ch = getchar();  // 使用 getchar() 读取一个字符,避免 scanf() 残留字符的影响
        switch (ch) {
            case '1':   // 录入学生信息
                inputstudent(n, m);
                break;
            case '2':   // 打印学生信息
                printstudent();
                break;
            case '3':   // 保存学生信息
                savestudent();
                break;
            case '4':   // 读取学生信息
                readstudent();
                break;
            case '5':   // 按总分由高到低排出名次
                scoreline_uptodown(n);
                break;
            case '6':   // 按总分由低到高排出名次
                scoreline_downtoup(n);
                break;
            case '7':   // 按学号由小到大排出成绩表
                idline_uptodown(n);
                break;
            case '8':   // 按姓名字典顺序排序排出成绩表


或者

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

typedef struct date {
    int year;
    int month;
    int day;
} DATE;

typedef struct stu {
    long stuID;        // 学号
    char stuname[11];  // 名字
    char stusex;       // 性别
    DATE birthday;     // 生日
    int score[4];      // 4科分数
    float aver;        // 平均分
} STU;

typedef struct node {
    STU stu;
    struct node* next;  // 指向下一个节点的指针
} NODE;

NODE* head = NULL;  // 定义头指针

struct node* creatnode();
void start();
void inputstudent(int n);                   // 录入学生信息
void printStudentInfo();                    // 打印学生信息
void saveStudentInfo();                     // 保存学生信息
void readStudentInfo();                     // 读取学生信息
void sortByTotalScoreDesc(STU stu[], int n); // 按总分由高到低排出名次
void sortByTotalScoreAsc(STU stu[], int n);  // 按总分由低到高排出名次
void sortByStuID(STU stu[], int n);          // 按学号由小到大排出成绩表
void sortByStuName(STU stu[], int n);        // 按姓名字典顺序排序排出成绩表
void calcTotalScore(STU stu[], int n);       // 计算学生总分及排名并能根据姓名查询学生成绩及排名
void calcRankByStuID(STU stu[], int n);      // 计算学生总分及排名并能根据学号查询学生成绩及排名

#define MAX_STU_NUM 100

int main() {
    STU stu[MAX_STU_NUM];
    int n, m = 4;

    printf("输入学生人数:");
    scanf("%d", &n);

    while (1) {
        start();
        char ch = getchar();
        switch (ch) {
            case '1':  // 录入学生信息
                inputstudent(n);
                break;
            case '2':  // 打印学生信息
                printStudentInfo();
                break;
            case '3':  // 保存学生信息
                saveStudentInfo();
                break;
            case '4':  // 读取学生信息
                readStudentInfo();
                break;
            case '5':  // 按总分由高到低排出名次
                sortByTotalScoreDesc(stu, n);
                break;
            case '6':  // 按总分由低到高排出名次
                sortByTotalScoreAsc(stu, n);
                break;
            case '7':  // 按学号由小到大排出成绩表
                sortByStuID(stu, n);
                break;
            case '8':  // 按姓名字典顺序排序排出成绩表
                sortByStuName(stu, n);
                break;
            case '9':  // 根据学号查询学生成绩及排名
                calcRankByStuID(stu,


以下答案引用自GPT-3大模型,请合理使用:

代码中存在多处错误,请根据注释修改如下:
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
typedef struct date
{
    int year;
    int month;
    int day;
}DATE;
typedef struct stu
{
    long stuID;     //学号
    char stuname[10];    //名字
    char stusex;     //性别
    DATE birthday;   //生日
    int score[4];    //4科分数
    float aver;      //平均分
}STU;
typedef struct node
{
    STU stu;
    struct node* next;   //指向下一个节点的指针
}NODE;
NODE* head = NULL;  //定义头指针
struct node* creatnode();
void start();
void inputstudent(STU stu[], int n, int m);   //录入学生信息
void totalscore(STU stu[], int n);   //计算学生总分及排名并能根据姓名查询学生成绩及排名
void savestudent();    //保存学生信息 
void scoreline_uptodown(STU stu[], int n);   //按每个学生的总分由高到底
#define N 30
int main()
{
    NODE* list = creatnode();    
    if (head == NULL)
    {
        head = list;
    }
    STU stu[N];
    int n;
    int m = 4;
    printf("输入学生人数:");
    scanf_s("%d", &n);
    while (1)
    {
        start();
        char ch = _getch();
        switch (ch)
        {
        case '1':  //录入学生信息
            inputstudent(stu,n,m);
            break;
        case '2':  //保存学生信息
            savestudent(); //去掉了void 
            break;
        case '3':  //按总分由高到低排出名次
            break;
        case '4':  //按总分由低到高排出名次
            break;
        case '5':  //按学号由小到大排出成绩表
            break;
        case '6':  //按姓名字典顺序排序排出成绩表
            break;
        case '7':  //计算学生总分及排名并能根据姓名查询学生成绩及排名
            totalscore(stu,n);
            break;
        case '8':  //计算学生总分及排名并能根据学号查询学生成绩及排名
            break;
        case '9':  //退出系统
            break;
        }
    }
    return 0;
}
void start()
{
        printf("*****************************************\n");
        printf("欢迎使用学生成绩管理

如果我的回答解决了您的问题,请采纳我的回答

你的代码,要先确定是用链表写,还是用数组写,不然写不下去。