C语言程序设计成绩管理系统源代码.docx

上传人:b****8 文档编号:29645698 上传时间:2023-07-25 格式:DOCX 页数:15 大小:16.37KB
下载 相关 举报
C语言程序设计成绩管理系统源代码.docx_第1页
第1页 / 共15页
C语言程序设计成绩管理系统源代码.docx_第2页
第2页 / 共15页
C语言程序设计成绩管理系统源代码.docx_第3页
第3页 / 共15页
C语言程序设计成绩管理系统源代码.docx_第4页
第4页 / 共15页
C语言程序设计成绩管理系统源代码.docx_第5页
第5页 / 共15页
点击查看更多>>
下载资源
资源描述

C语言程序设计成绩管理系统源代码.docx

《C语言程序设计成绩管理系统源代码.docx》由会员分享,可在线阅读,更多相关《C语言程序设计成绩管理系统源代码.docx(15页珍藏版)》请在冰豆网上搜索。

C语言程序设计成绩管理系统源代码.docx

C语言程序设计成绩管理系统源代码

#include

#include

#include

structstudent

{

charnumber[20];

charname[30];

floatscor_eng;

floatscor_math;

floatscor_phy;

};

voidprintlogin();

voidtchlogin(intxueshengnumber,structstudentrecord[100]);

voidstulogin();

voidaddeng(intxueshengnumber,structstudentrecord[100]);

voidaddmath(intxueshengnumber,structstudentrecord[100]);

voidaddphy(intxueshengnumber,structstudentrecord[100]);

intmycreat(intxueshengnumber,structstudentrecord[100]);

voidmyshow(intxueshengnumber,structstudentrecord[100]);

voidmyselect(intxueshengnumber,structstudentrecord[100]);

voidtongji(intxueshengnumber,structstudentrecord[100]);

intmain()

{

charchoose,yesorno;

structstudentrecord[100];//用结构体代替原来的5个数组

intxueshengnumber=0;/*输入的学生数*/

do

{

printlogin();/*打印菜单界面*/

choose=getch();

while(choose>'6'||choose<'0')

{

printf("请在0-5之间选择\n");

choose=getch();

}

switch(choose)

{

case'1':

{

xueshengnumber=mycreat(xueshengnumber,record);

break;

}

case'2':

{

tchlogin(xueshengnumber,record);

break;

}

case'3':

{

myselect(xueshengnumber,record);

break;

}

case'4':

{

tongji(xueshengnumber,record);

break;

}

case'5':

{

myshow(xueshengnumber,record);

break;

}

case'0':

{

printf("确实要退出系统吗?

");

break;

}

}

printf("\n要继续选择吗{Y/N}\n");

do

yesorno=getch();

while(yesorno!

='Y'&&yesorno!

='N'&&yesorno!

='y'&&yesorno!

='n');

}while(yesorno=='Y'||yesorno=='y');

return0;

}

voidprintlogin()//登陆界面

{

printf("|----------------------------------------------------------------------|\n");

printf("|用户登录|\n");

printf("|1:

录入学生成绩(包括姓名、学号)输入完成按“结束”|\n");

printf("|2:

教师登录|\n");

printf("|3:

学生成绩查询|\n");

printf("|4:

成绩统计|\n");

printf("|5:

显示全部成绩|\n");

printf("|0:

退出该系统;|\n");

printf("|注:

初次登陆请先录入学生信息|\n");

printf("|----------------------------------------------------------------------|\n");

}

voidtchlogin(intxueshengnumber,structstudentrecord[100])

{

structstudenttemp;

charchoose;

intx=0;

printf("|----------------------------------------------------------------------|\n");

printf("|教师登录|\n");

printf("|请输入教工号(1:

英语;2:

数学;3:

物理)|\n");

printf("||\n");

choose=getch();

switch(choose)

{

case'1':

{

do

{

x++;

addeng(xueshengnumber,record);

}

while(x<=xueshengnumber);

break;

}

case'2':

{

do

{

x++;

addmath(xueshengnumber,record);

}

while(x<=xueshengnumber);

break;

}

case'3':

{

do

{

x++;

addphy(xueshengnumber,record);

}

while(x<=xueshengnumber);

break;

}

}

}

intmycreat(intxueshengnumber,structstudentrecord[100])

{

structstudenttemp;

intx;

printf("请输入第%d个记录:

\n",xueshengnumber+1);

printf("姓名(用#结束):

\n");

do

gets(temp.name);

while(strcmp(temp.name,"")==0);

printf("学号(用#结束):

\n");

do

gets(temp.number);

while(strcmp(temp.number,"")==0);

//输入结束控制

while(temp.name[0]!

='#'&&temp.number[0]!

='#')

{

//保存到数组中

record[xueshengnumber]=temp;

xueshengnumber++;

//重复上次输入

printf("请输入第%d个记录:

\n",xueshengnumber+1);

printf("姓名(用#结束):

\n");

do

gets(temp.name);

while(strcmp(temp.name,"")==0);

printf("学号(用#结束):

\n");

do

gets(temp.number);

while(strcmp(temp.number,"")==0);

}

return(xueshengnumber);

}

//显示模块

voidmyshow(intxueshengnumber,structstudentrecord[100])

{

inti;

if(xueshengnumber==0)printf("请先录入学生成绩,再显示学生成绩\n");

else

{

printf("姓名学号英语成绩数学成绩物理成绩\n");

for(i=0;i

{

printf("%-15s",record[i].name);

printf("%-15s",record[i].number);

printf("%-13f",record[i].scor_eng);

printf("%-13f",record[i].scor_math);

printf("%-13f",record[i].scor_phy);

printf("\n");

}

}

}

/*查询模块*/

voidmyselect(intxueshengnumber,structstudentrecord[100])

{

inti;

chartempnumber[20]="";

printf("\n\n请输入要查询的学生学号:

");

do

gets(tempnumber);

while(strcmp(tempnumber,"")==0);

for(i=0;i

if(strcmp(tempnumber,record[i].number)==0)

{

printf("查询结果:

\n");

printf("姓名学号英语成绩数学成绩物理成绩\n");

printf("%-15s",record[i].name);

printf("%-15s",record[i].number);

printf("%-13f",record[i].scor_eng);

printf("%-13f",record[i].scor_math);

printf("%-13f",record[i].scor_phy);

printf("\n");

}

}

voidaddeng(intxueshengnumber,structstudentrecord[100])//添加英语成绩

{

inti;

structstudenttemp;

printf("请输入学生学号\n");

do

gets(temp.number);

while(strcmp(temp.number,"")==0);

for(i=0;i

if(strcmp(temp.number,record[i].number)==0)break;//从此分支出来的i是有此学生的

if(i==xueshengnumber)//表明整个循环走完了也没找到与tempnumber相等的学号

printf("查询结果无此学生\n");

else

{

printf("请输入英语成绩\n");

do

{

fflush(stdin);

scanf("%f",&temp.scor_eng);

}

while(temp.scor_eng>100.0||temp.scor_eng<0.0);

record[i].scor_eng=temp.scor_eng;

}

}

voidaddmath(intxueshengnumber,structstudentrecord[100])//添加数学成绩

{

inti;

structstudenttemp;

printf("请输入学生学号\n");

do

gets(temp.number);

while(strcmp(temp.number,"")==0);

for(i=0;i

if(strcmp(temp.number,record[i].number)==0)break;//从此分支出来的i是有此学生的

if(i==xueshengnumber)//表明整个循环走完了也没找到与tempnumber相等的学号

printf("查询结果无此学生\n");

else

{

printf("请输入数学成绩\n");

do

{

fflush(stdin);

scanf("%f",&temp.scor_math);

}

while(temp.scor_math>100.0||temp.scor_math<0.0);

record[i].scor_math=temp.scor_math;

}

}

voidaddphy(intxueshengnumber,structstudentrecord[100])//添加物理成绩

{

inti;

structstudenttemp;

printf("请输入学生学号\n");

do

gets(temp.number);

while(strcmp(temp.number,"")==0);

for(i=0;i

if(strcmp(temp.number,record[i].number)==0)break;//从此分支出来的i是有此学生的

if(i==xueshengnumber)//表明整个循环走完了也没找到与tempnumber相等的学号

printf("查询结果无此学生\n");

else

{

printf("请输入物理成绩\n");

do

{

fflush(stdin);

scanf("%f",&temp.scor_phy);

}

while(temp.scor_phy>100.0||temp.scor_phy<0.0);

record[i].scor_phy=temp.scor_phy;

}

}

voidtongji(intxueshengnumber,structstudentrecord[100])

{

floatmax,min,ave,sum;

intcross=0,flunk,num=0,t=0;

inti,chs;

charchoose;

flunk=xueshengnumber;

printf("|----------------------------------------------------------------------|\n");

printf("|请选择课程|\n");

printf("|1.英语|\n");

printf("|2.数学|\n");

printf("|3.物理|\n");

printf("|----------------------------------------------------------------------|\n");

choose=getch();

switch(choose)

{

case'1':

{

for(i=0;i

sum+=record[i].scor_eng;

ave=sum/xueshengnumber;

max=record[0].scor_eng;

min=record[0].scor_eng;

for(i=1;i

{

if(record[i].scor_eng>=60)

{

flunk--;

if(record[i].scor_eng>max)

max=record[i].scor_eng;

}

if(record[i].scor_eng

min=record[i].scor_eng;

if(record[i].scor_eng>ave)

cross++;

}

break;

}

case'2':

{

for(i=0;i

sum+=record[i].scor_math;

ave=sum/xueshengnumber;

max=record[0].scor_math;

min=record[0].scor_math;

for(i=1;i

{

if(record[i].scor_math>=60)

{

flunk--;

if(record[i].scor_math>max)

max=record[i].scor_math;

}

if(record[i].scor_math

min=record[i].scor_math;

if(record[i].scor_math>ave)

cross++;

}

break;

}

case'3':

{

for(i=0;i

sum+=record[i].scor_phy;

ave=sum/xueshengnumber;

max=record[0].scor_phy;

min=record[0].scor_phy;

for(i=1;i

{

if(record[i].scor_phy>=60)

{

flunk--;

if(record[i].scor_phy>max)

max=record[i].scor_phy;

}

if(record[i].scor_phy

min=record[i].scor_phy;

if(record[i].scor_phy>ave)

cross++;

}

break;

}

}

printf("|----------------------------------------------------------------------|\n");

printf("|最高分最低分平均分高于平均分人数不及格人数|\n");

printf("|%.2f%.2f%.2f%d%d|\n",max,min,ave,cross,flunk);

printf("|----------------------------------------------------------------------|\n");

}

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 解决方案 > 营销活动策划

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1