|
|
|
@ -0,0 +1,64 @@
|
|
|
|
|
#include"头文件.cpp"
|
|
|
|
|
int fun() //目录函数
|
|
|
|
|
{
|
|
|
|
|
int n;
|
|
|
|
|
system("cls");
|
|
|
|
|
printf("\n\n\t\t\t\t 成绩记录簿");
|
|
|
|
|
printf("\n\n\t\t\t");
|
|
|
|
|
for(int i=0;i<36;i++)
|
|
|
|
|
printf("*");
|
|
|
|
|
printf("\n");
|
|
|
|
|
printf("\t\t\t *************菜单***************\n");
|
|
|
|
|
printf("\t\t\t*|1、创建学生的信息! \t|*\n");
|
|
|
|
|
printf("\t\t\t*|2、输出所有学生的信息! \t|*\n");
|
|
|
|
|
printf("\t\t\t*|3、修改成绩! \t|*\n");
|
|
|
|
|
printf("\t\t\t*|4、查询! \t|*\n");
|
|
|
|
|
printf("\t\t\t*|5、显示成绩分段的学生信息! \t|*\n");
|
|
|
|
|
printf("\t\t\t*|6、学生成绩排名! \t|*\n");
|
|
|
|
|
printf("\t\t\t*|7、退出成绩记录簿! \t|*\n");
|
|
|
|
|
printf("\t\t\t *****设计者:吕永太 朱鹏俊****\n");
|
|
|
|
|
printf("\t\t\t");
|
|
|
|
|
for(int i=0;i<36;i++)
|
|
|
|
|
printf("*");
|
|
|
|
|
printf("\n\n");
|
|
|
|
|
printf("\n\t\t\t 请输入选项:");
|
|
|
|
|
scanf("%d",&n);
|
|
|
|
|
return n;
|
|
|
|
|
}
|
|
|
|
|
void input() //成绩输入
|
|
|
|
|
{
|
|
|
|
|
Student s[50];
|
|
|
|
|
system("cls");
|
|
|
|
|
int i=0;
|
|
|
|
|
FILE *fp;
|
|
|
|
|
fp=fopen("a.txt","a+");
|
|
|
|
|
printf("请以0作为输入学生学号信息的结束!\n");
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
printf("输入学生的学号:");
|
|
|
|
|
scanf("%lf",&s[i].no);
|
|
|
|
|
printf("输入学生的姓名:");
|
|
|
|
|
scanf("%s",s[i].name);
|
|
|
|
|
printf("输入学生的C语言成绩:");
|
|
|
|
|
scanf("%f",&s[i].cscore);
|
|
|
|
|
if(s[i].no!=0)
|
|
|
|
|
fprintf(fp,"%.0lf %-4s %.1f\n",s[i].no,s[i].name,s[i].cscore);
|
|
|
|
|
}while(s[i].no!=0);
|
|
|
|
|
fclose(fp);
|
|
|
|
|
}
|
|
|
|
|
void output() //成绩输出
|
|
|
|
|
{
|
|
|
|
|
if((fp=fopen("a.txt","r"))==NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("Cannot open the file!\n");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
printf("\t\t\t全部的学生信息:\n");
|
|
|
|
|
int k=0;
|
|
|
|
|
while(fscanf(fp,"%lf%s%f",&s[k].no,s[k].name,&s[k].cscore)!=EOF)
|
|
|
|
|
{
|
|
|
|
|
printf("\t\t\t%.0lf\t%s\t%.1f\n",s[k].no,s[k].name,s[k].cscore);
|
|
|
|
|
k++;
|
|
|
|
|
}
|
|
|
|
|
fclose(fp);
|
|
|
|
|
}
|