int main() //主函数
{
LINK head ;
int i = 0 ;
int choice = 0 ;
Uers pe[6] ;
int C_ount = 0 ;
int Cishu = 0;
int nnu;
char sex[20];
int old;
int x;
int y ;
float a,b;
long z;
long w;
while(1)
{
printf("请您登陆或注册用户\n");
printf("注册 = 1 ,登陆 = 2\n");
scanf("%d",&choice);
fflush(stdin);
if(choice == 1)
{
Cishu = ZhuCe(pe,&C_ount);
while(!Cishu)
{
Cishu = 2;
break;
}
break;
}
else if(choice == 2)
{
Cishu = DengLu(pe,C_ount);
if(Cishu == 5)
{
break;
}
while(!Cishu)
{
Cishu = DengLu(pe,C_ount);
}
if(Cishu == 2)
{
break;
}
}
else
{
printf("输入错误请重新输入\n");
}
}
if(Cishu == 2)
{
return 0;
}
while (1)
{
i = Menu();
if (i == 1)
{
printf("\t\t\t******************************************************************************\n");
}
switch (i)
{
case 2: //按平均分从高到低输出学生成绩;
Sort(head,PaixuAverage);
PrintAllStudentInformation(head);
break;
case 3: //按单门学科成绩从高到低输出学生信息;
printf("数学 = 0,语文 = 1,英语 = 2\n");
printf("请输入你的选择\n");
scanf("%d",&nnu);
head = s_ort(head ,desc, nnu);
PrintAllStudentInformation(head);
break;
case 4: //按学号从小到大顺序输出学生基本信息;
Sort(head,paixuxueHao);
PrintAllStudentInformation(head);
break;
case 5: //按字典从小到大顺序输出学生基本信息;
paixuName(head);
PrintAllStudentInformation(head);
break;
case 6: //按年龄和性别查找学生的基本信息;
printf("请输入学生的年龄和性别\n");
scanf("%d",&old);
getchar();
gets(sex);
fflush(stdin);
SearchStudent(head,sex,old);
break;
case 7: // 查找某门课成绩最高的学生的基本信息,某门课成绩最高的可能不只一名学生
printf("请输入科目 \n");
printf("数学 = 0 ,语文 = 1 ,英语 = 2\n");
fflush(stdin);
scanf("%d",&x);
SearchHighscore(head ,x);
break;
case 8: //查找某门课成绩在某个分数段内的学生人数和学生基本信息
printf("请输入科目\n");
printf("数学 = 0 ,语文 = 1 ,英语 = 2\n");
fflush(stdin);
scanf("%d",&y);
fflush(stdin);
printf("请输入分数区间,像:22--33 ");
scanf("%f%f",&a,&b);
PrintFenShuduan(head ,y ,a, b);
break;
case 9: //按学号查找学生基本信息,对学生信息进行修改后保存;
printf("请输入学生学号\n");
scanf("%ld",&z);
XiuGaiInformation(head,z);
break;
case 10: //按学号删除学生信息
printf("请输入学生学号\n");
scanf("%ld",&w);
DeleteStudentInformation(head ,w);
break;
case 11: //插入一名新的学生信息
InsertStudentInformation(head);
Old(head);
break;
case 12: //将学生信息写入文件
FileWrite(head);
break;
case 13: //按照姓名从文件读取学生信息
head = FileRead();
break;
case 1: //录入每个学生的基本信息
head = Input(head);
Average(head);
Old(head);
break;
case 0:
printf("\n\n\n");
printf("\t\t\t******************************************************************************\n");
printf("\t\t\tEnd of program!\n");
printf("\t\t\t******************************************************************************\n");
return 0;
default:
printf("\n\n\n");
printf("\t\t\t******************************************************************************\n");
printf("\t\t\tInput error!\n");
printf("\t\t\t******************************************************************************\n");
}
}
return 0;
}