c语言程序设计课程学籍管理系统源代码.docx
- 文档编号:2882739
- 上传时间:2022-11-16
- 格式:DOCX
- 页数:19
- 大小:19.69KB
c语言程序设计课程学籍管理系统源代码.docx
《c语言程序设计课程学籍管理系统源代码.docx》由会员分享,可在线阅读,更多相关《c语言程序设计课程学籍管理系统源代码.docx(19页珍藏版)》请在冰豆网上搜索。
c语言程序设计课程学籍管理系统源代码
附表1.程序源码
#include
#include
#include
#include
#defineN100
structstudent
{
charnum[13];
charname[18];
floatmath;
floatenglish;
floatcprogram;
floatcircuit;
floatlaw;
floatpingjun;
floatscore[5];
};
voidmainprint();
voidscoreprint();
voidstudentprint();
voidscoreInput();
voidscoreStat();
voidstudentStatus();
voidbukao();/*生成并打印补考通知单*/
voidtuixue();/*生成并打印退学通知单*/
voidxinmingdan();/*生成并打印新名单*/
voidsortAnhao();/*按学号排序*/
voidjisuanPingjun();/*计算平均分并排序*/
voidtongjiFenshu();/*统计分数段*/
voidfenxi();/*分析学生成绩,算出不及格门数*/\
voidmynew();/*创新功能*/
voidoutstudent();
voidoutdanke();
voidteshutuixue();
voidmain()
{
charchoose='\0',yes_no='\0';
do
{
system("color4f");
system("cls");
mainprint();
printf("");
choose=getche();
switch(choose)
{
case'1':
scoreInput();break;/*成绩录入*/
case'2':
scoreStat();break;
case'3':
studentStatus();break;
case'4':
mynew();break;
case'0':
break;
default:
printf("\n%c是非法选项!
\n");break;
}
if(choose=='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');
}
voidmainprint()
{printf("|******************************************|\n");
printf("|欢迎使用学籍管理系统|\n");
printf("|******************************************|\n");
printf("|请输入选项编号(0~4)|\n");
printf("|------------------------------------------|\n");
printf("|1--录入成绩|\n");
printf("|2--统计成绩|\n");
printf("|3--处理学籍|\n");
printf("|4--创新功能|\n");
printf("|0--退出|\n");
printf("|------------------------------------------|\n");
}
voidscoreInput()
{inti=0;charyes_no='\0';
structstudentex1[N]={0};
FILE*fp=NULL;
system("color5f");
system("cls");
fp=fopen("d:
\\学生基本信息.txt","w");
if(fp==NULL)
{printf("\n打开文件失败!
\n");return;}
printf("\n欢迎进入成绩录入系统\n");
printf("\n请输入第%d个记录:
\n",i+1);
printf("\n输入学生学号:
(用#结束程序)");
scanf("%s",ex1[i].num);
printf("\n输入学生姓名:
(用#结束程序)");
scanf("%s",ex1[i].name);
printf("\n请依次输入学生的数学、英语、c编程、电路设计和法律基础的成绩:
\n");
scanf("%f%f%f%f%f",&ex1[i].math,&ex1[i].english,&ex1[i].cprogram,&ex1[i].circuit,&ex1[i].law);
while(ex1[i].num[0]!
='#'&&ex1[i].name[0]!
='#')
{fprintf(fp,"%3d%15s%16s%7.1f%7.1f%7.1f%7.1f%7.1f\n",i,ex1[i].num,ex1[i].name,ex1[i].math,ex1[i].english,ex1[i].cprogram,ex1[i].circuit,ex1[i].law);
i++;
printf("\n请输入第%d个记录:
\n",i+1);
printf("\n输入学生学号:
(用#结束程序)");
scanf("%s",ex1[i].num);
printf("\n输入学生姓名:
(用#结束程序)");
scanf("%s",ex1[i].name);
printf("\n请依次输入学生的数学、英语、c编程、电路设计和法律基础的成绩:
\n");
scanf("%f%f%f%f%f",&ex1[i].math,&ex1[i].english,&ex1[i].cprogram,&ex1[i].circuit,&ex1[i].law);
}
fclose(fp);
}
voidscoreStat()
{charchoose='\0',yes_no='\0';
system("color9f");
do
{
system("cls");
printf("\n欢迎选择成绩统计系统\n");/*显示菜单*/
printf("\n|------------------------|");
printf("\n|请输入选项编号(0~4)|");
printf("\n|------------------------|");
printf("\n|1--按学号排序|");
printf("\n|2--按平均分数排序|");
printf("\n|3--统计分数段|");
printf("\n|4--返回|");
printf("\n|0--退出系统|");
printf("\n|------------------------|\n");
choose=getch();
switch(choose)
{
case'1':
sortAnhao();break;
case'2':
jisuanPingjun();break;
case'3':
tongjiFenshu();break;
case'4':
main();break;
case'0':
break;
default:
printf("\n%c是非法选项!
\n");break;
}
if(choose=='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');
}
voidsortAnhao()
{inti=0,j=0,n=0;
structstudentex2[N]={0},temp={0};
FILE*fp=NULL;
system("color9f");
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%f\n",&i,&ex2[i].num,ex2[i].name,&ex2[i].math,&ex2[i].english,&ex2[i].cprogram,&ex2[i].circuit,&ex2[i].law);
i++;n++;}
fclose(fp);
for(i=0;i for(j=i+1;j if(strcmp(ex2[i].num,ex2[j].num)>0) {temp=ex2[i]; ex2[i]=ex2[j]; ex2[j]=temp; } fp=fopen("d: \\按学号排序.txt","w"); if(fp==NULL) {printf("\n打开文件失败! \n");return;} fprintf(fp,"序号学号姓名高数英语编程电路法律\n"); for(i=0;i printf("\n文件已保存至D: \\按学号排序.txt\n"); fclose(fp); } voidjisuanPingjun() {inti=0,j=0,n=0; charc='\0'; structstudentex2[N]={0},temp={0}; FILE*fp=NULL; system("color9f"); 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%f\n",&i,ex2[i
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 语言程序设计 课程 学籍 管理 系统 源代码