学生管理系统(代码有瑕疵)

#include <stdio.h>
#include <stdlib.h>
#define N 1000
#define LEN sizeof(struct Student)
struct Student {
    int num[20];//学号
    char name[20];//姓名
    int Class[20];//班级
    float score[5];//该生在五门课程中所获得的分值
    float average[N];//学生五门课程的平均成绩 
    int levels[5];//五门课程的等级
    struct Student *next; 
}stu_information[N];
struct Course {
    int num;//课程编号
    char name[20];//课程名称
    int item[1000];//完成相应试题所获取的分值,假设每门课程最多包括1000道试题
};
int n;
int main()
{
    void Welcome();
    void InputStudent();
    void PrintStudent();
    while (1) {
        Welcome();
        char num;//num为起初选择的数字
        num = getchar();
        switch (num) {
        case'1':InputStudent(); break;//输入班级,学号,姓名,以逗号分离隔开
        case'2':printf("the calculating have been ended.Press any key to continue..."); break;//计算已结束,按任意键继续
        case'3':PrintStudent();break;
        case'4': {
            PrintStudent();
            break;
        }
        case'5': { system("cls");
            printf("\n\n\n                     Please input class number:"); break;
        }
        case'6':printf("Please input class,number,name,seperated by 'Enter'"); break;
        case'0':printf("Thanks for using!\n"); break;
        default:printf("input error!");break;
        }
        if(num=='0'||'1'||'2'||'3'||'4'||'5'||'6')break;
    }
    return 0;
}
void Welcome()//进入欢迎使用界面
{
    printf("\n\n\n\n\n\n");
    printf("                              |******Student Grade Management System******|\n");//学生成绩管理系统
    printf("                              |-------------------------------------------|\n");
    printf("                              |   Please  input  your  choose( 0--6 ):    |\n");//请输入你的选择(0--6)
    printf("                              |-------------------------------------------|\n");
    printf("                              |    1----input student's grades            |\n");//录入学生的成绩
    printf("                              |    2----calculate the average value       |\n");//计算平均值
    printf("                              |    3----output original grades            |\n");//输出原始成绩
    printf("                              |    4----sort by average value             |\n");//按平均值排序
    printf("                              |    5----modify the student's grade        |\n");//更改学生成绩
    printf("                              |    6----add the student's grade           |\n");//添加学生成绩
    printf("                              |    0----exit the system                   |\n");//退出系统
    printf("                              |-------------------------------------------|\n");
}
void InputStudent()//录入学生信息
{
    struct Student *head,*p1,*p2;
    head=NULL;
    n=0;
    p1=p2=(struct Student *)malloc(LEN);
    printf("input class,number,name,seperated by ‘ ,’\n");
    scanf("%c,%c,%c",&p1->Class,&p1->num,p1->name);
    if(p1->Class!=0)
    {
    printf("Please input the points for each of the 5 scores:\n");//请分别输入5门课程分值
    printf("score1:");scanf("%f",&p1->score[0]);printf("\n");
    printf("score2:");scanf("%f",&p1->score[1]);printf("\n");
    printf("score3:");scanf("%f",&p1->score[2]);printf("\n");
    printf("score4:");scanf("%f",&p1->score[3]);printf("\n");
    printf("score5:");scanf("%f",&p1->score[4]);printf("\n");
    }
    while(p1->Class!=0)
    {
    n+=1;
    if(n==1)head=p1;
    else p2->next=p1;
    p2=p1;
    p1=(struct Student *)malloc(LEN);
    printf("input class,number,name,seperated by ‘ ,’\n");
    scanf("%c,%c,%c",&p1->Class,&p1->num,p1->name);
    if(p1->Class!=0)
    {
    printf("Please input the points for each of the 5 scores:\n");//请分别输入5门课程分值
    printf("score1:");scanf("%f",&p1->score[0]);printf("\n");
    printf("score2:");scanf("%f",&p1->score[1]);printf("\n");
    printf("score3:");scanf("%f",&p1->score[2]);printf("\n");
    printf("score4:");scanf("%f",&p1->score[3]);printf("\n");
    printf("score5:");scanf("%f",&p1->score[4]);printf("\n");
    }
    p2->next=NULL;
    printf("Information entered successfully!");//录入信息成功 

}
}
void PrintStudent()
{
    system("cls");
    printf("                                          Sorted information is:\n");//排序后的信息是
    printf("\t\t   class   number   name   score1   score2   score3   score4   score5   average\n\n\n\n");
    printf("                                Press any key to continue..."); 
}

为什么我仅仅输入了1,1,a,直接显示这么多?

img

31行Printstudent,s小写了