void xuanke_information()//统计选课情况 { int mai_n(); int total=0; int a; FILE *fp; struct student s; if((fp=fopen("student.txt","r"))==NULL)//文件没有内容报错 { printf("\nCannot open student!\n"); } printf(" 学号 课程编号 课程名称\n"); for(;!feof(fp);) {fscanf(fp,"%d%d%s\n",&s.snum,&s.cnum,&s.cname); total++; printf("%7d%9d%13s\n",s.snum,s.cnum,s.cname); } printf("\n 选课学生总人数为:%d 人",total); fclose(fp); printf("\n1-返回菜单;2-退出系统\n"); scanf("%d",&a);system("cls");//清屏 if(a==1) mai_n(); else exit(0); }