没有合适的资源?快使用搜索试试~ 我知道了~
学生信息管理系统C语言版.doc
5星 · 超过95%的资源 3 下载量 85 浏览量
2022-12-16
04:35:27
上传
评论
收藏 81KB DOC 举报
温馨提示
试读
20页
学生信息管理系统C语言版.doc
资源推荐
资源详情
资源评论
滁州学院
页脚内容 1
//交流学习
//QQ:1194758555
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<ctype.h>
#include<windows.h>
int k,n;
struct student
{
double yuwen;
double shuxue;
double yingyu;
double zong;
double pingjun;
char name[20];
char num[20];
} stu[1000];
void jiazai(struct student stu[],int *num1);
void baocun(struct student stu[],int n);
void find(struct student stu[],int n);
int findnum(struct student stu[],int n,char *num);//查找学号;
void shanchu(struct student stu[],int *num1);
void shanchuyi(struct student stu[],int *num1);//删除一条记录;
void shanchuquanbu(struct student stu[],int *num1);
void tianjiayi(struct student stu[],int i);//添加一记录;
void tianjia(struct student stu[],int *num1);//添加记录;
void xiugai(struct student stu[],int n);//修改一条记录;
void output(struct student stu[],int n,int x);//打印信息;
void paixu(struct student stu[],int n);//排序;
int jianchaxuehao(struct student stu[],char *num);//检查学号的合法
性;
int jianchachengji(double num);//检查成绩的合法性;
void outputone(struct student *stu,int i,int x);//输出一条信息
void caidan();
int main()
{
int q;
jiazai(stu,&n);
caidan();
scanf("%d",&q);
滁州学院
页脚内容 2
while(q>6)
{
printf("输入错误请重新输入\n 请输入 0-6 的数字\n");
scanf("%d",&q);
}
Sleep(300);
system("cls");
switch(q)
{
case 1 :
tianjia(stu,&n);
break;
case 2:
xiugai(stu,n);
break;
case 3:
paixu(stu,n);
break;
case 4:
find(stu,n);
break;
case 5:
shanchu(stu,&n);
break;
case 6:
output(stu,n,0);
break;
case 0:
exit(0);
}
return 0;
}
void caidan()
{
printf("┌────────────────────────┐
\n");
printf("├───────欢迎进入学生信息管理系统─────┤
\n");
printf("├────────────────────────┤
\n");
printf("│ 1 添加学生成绩 │
\n");
printf("├────────────────────────┤
\n");
滁州学院
页脚内容 3
printf("│ 2 修改学生成绩 │
\n");
printf("├────────────────────────┤
\n");
printf("│ 3 排序 │
\n");
printf("├────────────────────────┤
\n");
printf("│ 4 查找 │
\n");
printf("├────────────────────────┤
\n");
printf("│ 5 删除 │
\n");
printf("├────────────────────────┤
\n");
printf("│ 6 输出 │
\n");
printf("├────────────────────────┤
\n");
printf("│ 0 退出 │
\n");
printf("├────────────────────────┤
\n");
printf("└────────────────────────┘
\n");
printf("请输入选择:\n");
}
void jiazai(struct student stu[],int *num1)
{
FILE *fp;
int i;
if((fp=fopen("d:\\student.dat","r"))==NULL)
{
*num1=0;
return;
}
for(i=0; fread(&stu[i],sizeof(struct student),1,fp)!=0; i++)
*num1=i;
fclose(fp);
}
void paixu(struct student stu[],int n)
{
滁州学院
页脚内容 4
int xuehao(const void *a,const void *b);
int yuwen(const void *a,const void *b);
int shuxue(const void *a,const void *b);
int yingyu(const void *a,const void *b);
int zongchengji(const void *a,const void *b);
int (*cmp[])(const void *a,const void *b)=
{xuehao,yuwen,shuxue,yingyu,zongchengji};
int a;
printf("┌───────────────────────┐
\n");
printf("│ 欢迎进入学生信息排序页面 │
\n");
printf("└───────────────────────┘
\n");
printf("┌───────────────────────┐
\n");
printf("│ 0:按学号降序排序 │
\n");
printf("├───────────────────────┤
\n");
printf("│ 1:按语文成绩降序排序 │
\n");
printf("├───────────────────────┤
\n");
printf("│ 2:按数学成绩降序排序 │
\n");
printf("├───────────────────────┤
\n");
printf("│ 3:按英语成绩降序排序 │
\n");
printf("├───────────────────────┤
\n");
printf("│ 4:安总成绩降序排序 │\n");
printf("└───────────────────────┘
\n");
printf("请输入选择:\n");
scanf("%d",&a);
Sleep(300);
system("cls");
qsort(stu,n,sizeof(stu[0]),cmp[a]);
output(stu,n,0);
}
int xuehao(const void *a,const void *b)
剩余19页未读,继续阅读
yyyyyyhhh222
- 粉丝: 403
- 资源: 6万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页