You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
acttive/xuanke_information.cpp

27 lines
526 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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);
}