1、c语言程序设计课程学籍管理系统源代码附表1.程序源码#include#include#include#include#define N 100struct student char num13; char name18; float math; float english; float cprogram; float circuit; float law; float pingjun; float score5;void mainprint();void scoreprint();void studentprint();void scoreInput();void scoreStat();vo
2、id studentStatus();void bukao(); /*生成并打印补考通知单*/void tuixue(); /*生成并打印退学通知单*/void xinmingdan(); /*生成并打印新名单*/void sortAnhao(); /*按学号排序*/void jisuanPingjun(); /*计算平均分并排序*/void tongjiFenshu(); /*统计分数段*/void fenxi(); /*分析学生成绩,算出不及格门数*/void mynew(); /*创新功能*/void outstudent();void outdanke();void teshutuix
3、ue();void main() char choose=0,yes_no=0; do system(color 4f); system(cls); mainprint(); printf( ); choose=getche( ); switch(choose) case1:scoreInput();break; /*成绩录入*/ case2:scoreStat();break; case3:studentStatus();break; case4:mynew();break; case0:break; default:printf(n %c是非法选项!n); break; if(choose
4、=0) break; printf(n 即将进入主菜单,要继续选择吗(Y/N)?n); do yes_no=getche( ); while(yes_no!=Y&yes_no!=y&yes_no!=N&yes_no!=n); while(yes_no=y|yes_no=Y); void mainprint() printf( |*|n); printf( | 欢迎使用学籍管理系统 |n); printf( |*|n); printf( | 请输入选项编号(04) |n); printf( |-|n); printf( | 1-录入成绩 |n); printf( | 2-统计成绩 |n); pr
5、intf( | 3-处理学籍 |n); printf( | 4-创新功能 |n); printf( | 0- 退出 |n); printf( |-|n);void scoreInput() int i=0;char yes_no=0; struct student ex1N=0; FILE *fp=NULL; system(color 5f); system(cls); fp=fopen(d:学生基本信息.txt,w); if(fp=NULL) printf(n 打开文件失败!n); return; printf(n欢迎进入成绩录入系统n); printf(n 请输入第%d个记录:n,i+1)
6、; printf(n输入学生学号:(用#结束程序); scanf(%s,ex1i.num); printf(n输入学生姓名:(用#结束程序); scanf(%s,ex1i.name); printf(n请依次输入学生的数学、英语、c编程、电路设计和法律基础的成绩:n); scanf(%f%f%f%f%f,&ex1i.math,&ex1i.english,&ex1i.cprogram,&ex1i.circuit,&ex1i.law); while(ex1i.num0!=#&ex1i.name0!=#) fprintf(fp,%3d%15s%16s%7.1f%7.1f%7.1f%7.1f%7.1f
7、n,i,ex1i.num,ex1i.name,ex1i.math,ex1i.english,ex1i.cprogram,ex1i.circuit,ex1i.law); i+; printf(n 请输入第%d个记录:n,i+1); printf(n输入学生学号:(用#结束程序); scanf(%s,ex1i.num); printf(n输入学生姓名:(用#结束程序); scanf(%s,ex1i.name); printf(n请依次输入学生的数学、英语、c编程、电路设计和法律基础的成绩:n); scanf(%f%f%f%f%f,&ex1i.math,&ex1i.english,&ex1i.cpr
8、ogram,&ex1i.circuit,&ex1i.law); fclose(fp);void scoreStat() char choose=0,yes_no=0; system(color 9f); do system(cls); printf(n 欢迎选择成绩统计系统n); /*显示菜单*/ printf(n |-|); printf(n | 请输入选项编号(04) |); printf(n |-|); printf(n | 1-按学号排序 |); printf(n | 2-按平均分数排序 |); printf(n | 3-统计分数段 |); printf(n | 4-返回 |); pr
9、intf(n | 0-退出系统 |); printf(n |-|n); choose=getch(); switch(choose) case1:sortAnhao();break; case2:jisuanPingjun();break; case3:tongjiFenshu();break; case4:main(); break; case0:break; default:printf(n %c是非法选项!n);break; if(choose=0) break; printf(n 要继续选择吗(Y/N)?n); do yes_no=getche(); while(yes_no!=Y&y
10、es_no!=y&yes_no!=N&yes_no!=n); while(yes_no=y|yes_no=Y);void sortAnhao() int i=0,j=0,n=0; struct student ex2N=0,temp=0; FILE *fp=NULL; system(color 9f); fp=fopen(d:学生基本信息.txt,r); if(fp=NULL) printf(n 打开文件失败!n); return; printf(n 欢迎进入按学号排序系统n); while(feof(fp)=0) fscanf(fp,%3d%15s%16s%f%f%f%f%fn,&i,&ex
11、2i.num,ex2i.name,&ex2i.math,&ex2i.english,&ex2i.cprogram,&ex2i.circuit,&ex2i.law); i+; n+; fclose(fp); for(i=0;in-1;i+) for(j=i+1;j0) temp=ex2i; ex2i=ex2j; ex2j=temp; fp=fopen(d:按学号排序.txt,w); if(fp=NULL) printf(n 打开文件失败!n); return; fprintf(fp,序号 学号 姓名 高数 英语 编程 电路 法律n); for(i=0;in;i+) fprintf(fp,%3d%
12、15s%16s%7.1f%7.1f%7.1f%7.1f%7.1fn,i,ex2i.num,ex2i.name,ex2i.math,ex2i.english,ex2i.cprogram,ex2i.circuit,ex2i.law); printf(n 文件已保存至D:按学号排序.txtn); fclose(fp);void jisuanPingjun() int i=0,j=0,n=0; char c=0; struct student ex2N=0,temp=0; FILE *fp=NULL; system(color 9f); fp=fopen(d:学生基本信息.txt,r); if(fp=NULL) printf(n 打开文件失败!n); return; printf(n 欢迎使用按学号排序系统n); while(feof(fp)=0) fscanf(fp,%3d%15s%16s%f%f%f%f%fn,&i,ex2i
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1