2022年C语言学生成绩信息管理系统C语言 .pdf





《2022年C语言学生成绩信息管理系统C语言 .pdf》由会员分享,可在线阅读,更多相关《2022年C语言学生成绩信息管理系统C语言 .pdf(8页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、/last #include #include #include #include #define HEADER1 -STUDENT-n #define HEADER2 | number | name | sex |n #define HEADER3 |-|-|-|n #define FORMAT 姓名 :%-6sn 性别 :%-6sn 学号 :%-6snn #define END -n #define DATA temp.Name,temp.Num,temp.Sex typedef struct _Student char Name12; char Sex4; char Num20; Stu
2、dent; void Menu(FILE *); void LuRu(FILE *); void SeekStudent(FILE *); void QingKong(FILE *); void JiaMi(char *, int); void JieMi(char *, int); void Delete(FILE *); void UpDate(FILE *); void JudgeFP(FILE *); int FileSize(FILE *); void DisPlay(FILE *fp); int main( ) FILE *fp; int choice; fp = fopen(st
3、udent.txt,ab+);JudgeFP(fp); fp = fopen(student.txt,rb+);JudgeFP(fp); if(fp = NULL) printf(ERROR!n); exit(0); while(1) 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 1 页,共 8 页 - - - - - - - - - system(cls); Menu(fp); scanf(%d,&choice); switch(choice) case 0:break; cas
4、e 1:LuRu(fp);break; case 2:SeekStudent(fp);break; case 3:QingKong(fp);break; case 4:Delete(fp);break; case 5:UpDate(fp);break; case 6:DisPlay(fp);break; default :printf( 输入错误 n); if(choice = 0)break; printf( 任意键返回主菜单);getch(); fflush(stdin); fclose(fp); return 0; void LuRu(FILE *fp)/ 录入 Student temp
5、; char ch; do printf( 姓名 :); scanf(%s,temp.Name); printf( 性别 :); scanf(%s,temp.Sex); printf( 编号 :); scanf(%s,temp.Num); fseek(fp, 0L, SEEK_END); /JiaMi(char *)&temp, sizeof(Student); fwrite(&temp, sizeof(Student), 1, fp); printf( 任意键继续录入0 跳出 n); fflush(stdin); while(ch = getch() != 0); 名师资料总结 - - -精
6、品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 2 页,共 8 页 - - - - - - - - - void QingKong(FILE *fp)/ 清空数据 if(fp = fopen(student.txt,wb) = NULL) printf(ERROR!n); return ; printf( 数据已清空 n); void SeekStudent(FILE *fp)/ 查询 Student temp; char in20; int i = 0, j; printf( 输入姓名或者学号查询:n);
7、scanf(%s,in); rewind(fp); for(j=0;jFileSize(fp);j+) while(!feof(fp) fseek(fp, j*sizeof(Student), SEEK_SET); fread(&temp, sizeof(Student), 1, fp);break; /JieMi(char *)&temp, sizeof(Student); if(strcmp(in,temp.Name) = 0 | strcmp(in,temp.Num) = 0) printf(FORMAT,DATA); i = 1; if(i = 0) printf( 没找到 n); v
8、oid Delete(FILE *fp)/ 删除 Student temp, del; Student blank = 0,0,0; char in20; int mycount = 0, i = 0, j; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 3 页,共 8 页 - - - - - - - - - if(FileSize(fp) = 0) printf( 无记录可删 n); return; if(FileSize(fp) = 1) QingKong(fp); print
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 2022年C语言学生成绩信息管理系统C语言 2022 语言 学生 成绩 信息管理 系统

限制150内