C语言教务管理系统2000行代码_第1页
C语言教务管理系统2000行代码_第2页
C语言教务管理系统2000行代码_第3页
C语言教务管理系统2000行代码_第4页
C语言教务管理系统2000行代码_第5页
已阅读5页,还剩44页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

./C语言教务管理系统一、程序结构图二、程序运行截图1.个人信息简介2.修改颜色3.注册界面4.信息保存至文件5.登录界面6.管理员录入信息7.学生信息录入8.学生成绩录入9.学生课程表录入10.学生信息查询界面11学生信息查询12.学生成绩查询13.学生课表查询三、代码〔一个cpp#include<stdio.h>#include<stdlib.h>#include<string.h>#include<ctype.h>#include<conio.h>#include"windows.h"#definestudent_num1000/*定义1000个学生*/#defineteacher_num5 /*定义5个老师〔管理员*/intis_my_student<structstudent*p,int*size>; /*声明返回第i+1个学生的函数*/intis_my_teacher<structteacher*p,int*size>; /*声明返回第i+1个老师的函数*/intlength_student_name<char*p>; /*声明验证用户名函数*/intlength_student_password<char*p>; /*声明验证密码长度函数*/intlength_teacher_name<char*p>; /*声明验证用户名函数*/intlength_teacher_password<char*p>; /*声明验证密码长度函数*/intshow_menu_login<>; /*声明登录菜单函数*/intshow_menu_register<>; /*声明注册菜单函数*/intshow_teacher_select<>; /*声明教师录入菜单函数*/intshow_student_select<>; /*声明学生查询菜单函数*/intstudent_register<structstudent*ptr_student,int*size>; /*声明学生注册函数*/intteacher_register<structteacher*ptr_teacher,int*size>; /*声明老师注册函数*/intvaild_student_name<char*p>; /*声明验证用户名函数*/intvaild_student_password<char*p>; /*声明验证密码函数*/intvaild_teacher_name<char*p>; /*声明验证用户名函数*/intvaild_teacher_password<char*p>; /*声明验证密码函数*/intvaild_two_password<char*p1,char*p2>; /*声明验证两次密码是否相同函数*/intyes_no_return<>; /*声明选择是否返回上一层函数*/voidload<>; /*声明加载函数*/voidregister_<int*count1,int*count2>; /*声明注册函数*/voiddisplay_student<structstudentstu>; /*声明显示学生信息函数*/voiddisplay_teacher<structteachertea>; /*声明显示老师信息函数*/voidstudent_file1<>; /*将保存的学生的账号密码存入文件中*/voidstudent_file2<>; /*将保存的学生的个人信息存入文件中*/voidstudent_file3<>; /*将保存的学生的成绩存入文件中*/voidteacher_file<>; /*将保存的老师的账号密码存入文件中*/voidinput_information<intcount>;/*声明输入学生信息函数*/voidinput_score_menu<intcount>; /*声明输入学生成绩函数*/voidcolor<>; /*声明选择窗体颜色函数*/voidprint_stu_information<intcount_stu>; /*声明输出账号为num的学生的信息函数*/voidprint_stu_score<intcount_stu>; /*声明输出账号为num的学生的成绩函数*/voidshow_menu<>; /*声明初始化界面函数*/voidinput<>; /*声明输入函数*/voidmenu1<>; /*声明教师录入课程表主菜单函数*/voidmenu2<>; /*声明学生查询课程表主菜单函数*/voidrank<>; /*声明显示时间顺序函数*/voidquerymenu3<>; /*声明查询函数*/voidlooktime<>; /*声明按照时间查询函数*/voidlooklessonname<>; /*声明按照课程名查询函数*/voidadd<>; /*声明保存函数*/voidamend<>; /*声明修改课程函数*/voidamend1<>; /*声明修改课程子函数*/voidamendnews<inti>; /*声明修改整个课程信息函数*/voidamendtime<inti>; /*声明修改课程时间函数*/voidamendlessonname<inti>; /*声明修改课程课程名函数*/voidamendclassroom<inti>; /*声明修改课程教室函数*/voiddeleted<>; /*声明删除函数*/voidadd_score<intcount>; /*声明添加学生成绩函数*/voidxiugai_score<intcount>; /*声明修改学生成绩函数*/voidshanchu_score<intcount>; /*声明删除学生成绩函数*/voidchaxun_score<intcount>; /*声明按要求查询学生成绩函数*/voidpaixu_score<intcount>; /*声明学生成绩排序函数*/voidtongji_score<intcount>; /*声明学生成绩统计函数*/floatchinese<intcount>; /*声明计算语文成绩最大值函数*/intchr<intcount>; /*声明计算语文成绩及格人数的函数*/floatenglish<intcount>; /*声明计算英语成绩最大值函数*/intehr<intcount>; /*声明计算英语成绩及格人数的函数*/floatmath<intcount>; /*声明计算数学成绩最大值函数*/intmhr<intcount>; /*声明计算数学成绩及格人数的函数*/floatcomputer<intcount>; /*声明计算计算机成绩最大值函数*/intthr<intcount>; /*声明计算计算机成绩及格人数的函数*/floatPE<intcount>; /*声明计算体育成绩最大值函数*/intphr<intcount>; /*声明计算体育成绩及格人数的函数*/floatsum_score<intcount>; /*声明计算总分成绩最大值函数*/voidload_student<inta>; /*声明启动学生函数*/voidload_teacher<inta>; /*声明启动老师函数*/structstudent /*学生结构体*/{ /*个人信息*/ intstudent_id; /*账号*/ charstudent_name[20];/*姓名*/ charpassword[16]; /*密码*/ intage; /*年龄*/ charqq[12]; /*QQ号*/ chartel[12]; /*电话*/ intgrade; /*年级*/ /*各科成绩*/ floatchinese; /*语文分数*/ floatenglish; /*英语分数*/ floatmath; /*数学分数*/ floatcomputer; /*计算机分数*/ floatPE; /*体育分数*/ floatsum; /*总分*/ /*课程表*/ chartime[10];/*时间*/ charlessonname[20];/*课程名*/ charteacher[20];/*授课老师*/ charclassroom[10];/*教室*/charhours[10];/*第几节课*/ intweeks;/*周时*/};structteacher /*老师结构体*/{ intteacher_id; /*账号*/ charteacher_name[20]; /*姓名*/ charpassword[16]; /*密码*/};structstudentour_student[student_num];structteacherour_teacher[teacher_num];voidmain<> /*主函数*/{ system<"colorf0">; /*初始化背景颜色*/ show_menu<>; /*制作人信息简介*/ load<>;}voidload<> /*启动函数*/{ intflag=1; /*控制循环结束的变量*/ inta=0,b=0; /*记录已注册的学生的人数a为学生个数b为老师个数*/ int*count1=&a,*count2=&b; /*指向学生人数和老师人数的指针*/ intcorrect_student,correct_teacher; color<>; register_<count1,count2>; /*注册学生和老师的帐号*/ student_file1<>; teacher_file<>; while<flag> { switch<show_menu_login<>>/*显示登录菜单*/ { case1:/*选择1,进入学生登录*/ if<correct_student=is_my_student<our_student,count1>> { printf<"\n ◆学生登录成功!\n">; display_student<our_student[correct_student-1]>; printf<"\n">; printf<" ">; system<"pause">; load_student<a>; } else printf<"\n登录失败!\n">; printf<"\n">; printf<" 提示:按Y退出登录界面,按N返回登录界面!!!\n">; flag=yes_no_return<>; system<"cls">; break; case2:/*选择2,进入老师登录,即管理员登录*/ if<correct_teacher=is_my_teacher<our_teacher,count2>> { printf<"\n ◆管理员登录成功!\n">; display_teacher<our_teacher[correct_teacher-1]>; printf<"\n">; printf<" ">; system<"pause">; load_teacher<a>; } else printf<"\n登录失败!\n">; printf<"\n">; printf<" 提示:按Y退出登录界面,按N返回登录界面!!!\n">; flag=yes_no_return<>; system<"cls">; break; case3:/*选择3,退出登录*/ system<"cls">; flag=0; break; default: printf<"请正确输入1-3:">; system<"cls">; } } }voidload_student<inta> /*启动学生函数*/{ intflag=1; system<"cls">; while<flag> { switch<show_student_select<>> { case1: /*选择1,学生信息查询*/ system<"cls">; print_stu_information<a>; printf<"\n">; printf<" 提示:按Y退出学生查询界面,按N返回学生查询界面!!!\n">; flag=yes_no_return<>; system<"cls">; break; case2: /*选择2,学生成绩查询*/ system<"cls">; print_stu_score<a>; printf<"\n">; printf<" 提示:按Y退出学生查询界面,按N返回学生查询界面!!!\n">; flag=yes_no_return<>; system<"cls">; break; case3: /*选择3,学生课表查询*/ menu2<>; printf<" 提示:按Y退出学生查询界面,按N返回学生查询界面!!!\n">; flag=yes_no_return<>; system<"cls">; break; case4: /*选择4,退出查询界面*/ system<"cls">; flag=0; break; default: printf<"请正确输入1-4:">; system<"cls">; } }}voidload_teacher<inta> /*启动老师函数*/{ intflag=1; system<"cls">; while<flag> { switch<show_teacher_select<>> { case1: /*选择1,学生信息录入*/ input_information<a>; system<"cls">; student_file2<>; printf<"\n 提示:按Y退出教师录入界面,按N返回教师录入界面!!!\n">; flag=yes_no_return<>; system<"cls">; break; case2: /*选择2,学生成绩录入*/ input_score_menu<a>; system<"cls">; student_file3<>; printf<"\n 提示:按Y退出教师录入界面,按N返回教师录入界面!!!\n">; flag=yes_no_return<>; system<"cls">; break; case3: /*选择3,学生课表录入*/ menu1<>; printf<" 提示:按Y退出教师录入界面,按N返回教师录入界面!!!\n">; flag=yes_no_return<>; system<"cls">; break; case4: /*选择4,退出管理界面*/ system<"cls">; flag=0; break; default: printf<"请正确输入1-4:">; system<"cls">; } }}intlength_student_name<char*p> /*验证用户名是否合法*/{ intl; l=strlen<p>; if<l>20||l<1> return0; else return1;}intvaild_student_name<char*p> /*判断用户名是否有效*/{ inti=0; intlen=strlen<p>; if<<*p>='a'&&*p<='z'>||<*p>='A'&&*p<='Z'>> /*判断首字母是不是字母*/ { for<i=0;i<len;i++> { if<!<p[i]='_'||<p[i]>='a'&&p[i]<='z'>||<p[i]>='A'&&p[i]<='Z'>||<p[i]>='0'&&p[i]<='9'>>> /*判断后面的字符是否有效*/ return0; } return1; } else return0;}intlength_student_password<char*p> /*密码长度有效性验证*/{ intlen; len=strlen<p>; if<len<6||len>16> return0; else return1;}intvaild_student_password<char*p> /*密码的有效性验证*/{ inti=0; for<;*p!='\0';p++> { if<!<<*p>='a'&&*p<='z'>||<*p>'A'&&*p<'Z'>||<*p>='0'&&*p<='9'>>> return0; } return1;}intvaild_two_password<char*p1,char*p2> /*验证两次密码是否相同*/{ if<strcmp<p1,p2>==0> return1; else return0;}intstudent_register<structstudent*ptr_student,int*size> /*完成注册功能*/{ charpassword[16]; charrepassword[16]; if<*size==student_num> { puts<" ◆注册人数已满!">; printf<"\n">; return0; } system<"cls">; printf<"\n\n">; printf<" ★请输入注册学生姓名:">; fflush<stdin>; gets<ptr_student[*size].student_name>; if<!<length_student_name<ptr_student[*size].student_name>&&vaild_student_name<ptr_student[*size].student_name>>> { printf<" ◆您输入的姓名无效,学生姓名在1-20之间,首字符为字母,后面必须为字母、数字或下划线!!!">; return0; } printf<"\n">; printf<" ★请输入注册密码:">; fflush<stdin>; gets<password>; printf<"\n">; printf<" ★请再次输入注册密码:">; fflush<stdin>; gets<repassword>; printf<"\n">; if<!vaild_two_password<password,repassword>> { printf<"\n №:两次输入的密码不一致!!!">; printf<"\n">; return0; } else strcpy<ptr_student[*size].password,password>; if<!<length_student_password<ptr_student[*size].password>&&vaild_student_password<ptr_student[*size].password>>> { printf<" ◆您输入的密码无效,密码应在6-16位之间,密码只能包含字母和数字!!!">; printf<"\n">; return0; } printf<" ★您的编号为:%d,这将是您的登录账号!!!",ptr_student[*size].student_id=20150000+*size>; return1;}intis_my_student<structstudent*p,int*size> /*如果登录成功则返回第i+1个学生的信息,否则返回0*/{ inti; intzhanghao; charmima[18]; system<"cls">; printf<"\n\n">; printf<" ★请输入您的账号:">; scanf<"%d",&zhanghao>; fflush<stdin>; printf<"\n">; printf<" ★请输入您的密码:">; gets<mima>; for<i=0;i<*size;i++> { if<<zhanghao==p[i].student_id>&&<strcmp<mima,p[i].password>==0>> returni+1; } return0;}voiddisplay_student<structstudentstu> /*显示学生信息*/{ printf<"\n ★您的账号是:%d\n",stu.student_id>;}intlength_teacher_name<char*p> /*验证用户名是否合法*/{ intl; l=strlen<p>; if<l>20||l<1> return0; else return1;}intvaild_teacher_name<char*p> /*判断用户名是否有效*/{ inti=0; intlen=strlen<p>; if<<*p>='a'&&*p<='z'>||<*p>='A'&&*p<='Z'>> /*判断首字母是不是字母*/ { for<i=0;i<len;i++> { if<!<p[i]='_'||<p[i]>='a'&&p[i]<='z'>||<p[i]>='A'&&p[i]<='Z'>||<p[i]>='0'&&p[i]<='9'>>> /*判断后面的字符是否有效*/ return0; } return1; } else return0;}intlength_teacher_password<char*p> /*密码长度有效性验证*/{ intlen; len=strlen<p>; if<len<6||len>16> return0; else return1;}intvaild_teacher_password<char*p> /*密码的有效性验证*/{ inti=0; for<;*p!='\0';p++> { if<!<<*p>='a'&&*p<='z'>||<*p>'A'&&*p<'Z'>||<*p>='0'&&*p<='9'>>> return0; } return1;}intteacher_register<structteacher*ptr_teacher,int*size> /*完成注册功能*/{ charpassword[16]; charrepassword[16]; if<*size==teacher_num> { puts<" ◆注册人数已满!">; printf<"\n">; return0; } system<"cls">; printf<"\n\n">; printf<" ★请输入注册教师姓名:">; fflush<stdin>; gets<ptr_teacher[*size].teacher_name>; if<!<length_teacher_name<ptr_teacher[*size].teacher_name>&&vaild_teacher_name<ptr_teacher[*size].teacher_name>>> { printf<" ◆您输入的姓名无效,教师姓名在1-20之间,首字符为字母,后面必须为字母、数字或下划线!!!">; printf<"\n">; return0; } printf<"\n">; printf<" ★请输入注册密码:">; fflush<stdin>; gets<password>; printf<"\n">; printf<" ★请再次输入注册密码:">; fflush<stdin>; gets<repassword>; printf<"\n">; if<!vaild_two_password<password,repassword>> { printf<"\n №:两次输入的密码不一致!!!">; printf<"\n">; return0; } else strcpy<ptr_teacher[*size].password,password>; if<!<length_teacher_password<ptr_teacher[*size].password>&&vaild_teacher_password<ptr_teacher[*size].password>>> { printf<" ◆您输入的密码无效,密码应在6-16位之间,密码只能包含字母和数字!!!">; printf<"\n">; return0; } printf<" ★您的编号为:%d,这将是您的登录账号。",ptr_teacher[*size].teacher_id=20150+*size>; return1;}intis_my_teacher<structteacher*p,int*size> /*如果登录成功则返回第i+1个老师的信息,否则返回0*/{ inti; intzhanghao; charmima[18]; system<"cls">; printf<"\n\n">; printf<" ★请输入您的账号:">; scanf<"%d",&zhanghao>; fflush<stdin>; printf<"\n">; printf<" ★请输入您的密码:">; gets<mima>; for<i=0;i<*size;i++> { if<<zhanghao==p[i].teacher_id>&&<strcmp<mima,p[i].password>==0>> returni+1; } return0;}voiddisplay_teacher<structteachertea> /*显示老师信息*/{ printf<"\n ★您的账号是:%d\n",tea.teacher_id>;}voidregister_<int*count1,int*count2> /*注册函数*/{ inti=1; while<i> { switch<show_menu_register<>> { case1: if<student_register<our_student,count1>> { <*count1>++; printf<"\n">; printf<"\n ★注册成功!\n">; printf<"">; system<"pause">; system<"cls">; } break; case2: if<teacher_register<our_teacher,count2>> { <*count2>++; printf<"\n">; printf<"\n ★注册成功!\n">; printf<"">; system<"pause">; system<"cls">; } break; case3: i=0; system<"cls">; break; default: printf<"请正确输入:\n">; printf<"">; system<"pause">; system<"cls">; } }}voidinput_information<intcount>{ intk; system<"cls">; for<k=0;k<count;k++> { printf<"\n\n">; printf<"\t请输入第%d位同学的信息\n",k+1>; printf<"\t\t请录入学号为%d的学生的年龄:",our_student[k].student_id>; scanf<"%d",&our_student[k].age>; printf<"\n">; printf<"\t\t请录入学号为%d的学生的QQ号:",our_student[k].student_id>; scanf<"%s",our_student[k].qq>; printf<"\n">; printf<"\t\t请录入学号为%d的学生的电话:",our_student[k].student_id>; scanf<"%s",our_student[k].tel>; printf<"\n">; printf<"\t\t请录入学号为%d的学生的年级:",our_student[k].student_id>; scanf<"%d",&our_student[k].grade>; printf<"\n">; printf<"\t\t您已经成功将学号为%d的学生的信息录入!!!\n",our_student[k].student_id>; }}voidinput_score_menu<intcount>{ intnumber,i=1; system<"cls">; printf<"\n\n">; printf<"\t*************************学生成绩管理*************************\n">; printf<"\t**\n">; printf<"\t*1.☆添加学生成绩☆*\n">; printf<"\t*2.☆修改学生成绩☆*\n">; printf<"\t*3.☆删除学生成绩☆*\n">; printf<"\t*4.☆按要求查询学生成绩☆*\n">; printf<"\t*5.☆按要求排序☆*\n">; printf<"\t*6.☆按要求统计成绩☆*\n">; printf<"\t*7.☆退出学生成绩管理☆*\n">; printf<"\t**\n">; printf<"\t******************请输入选择的功能编号<1-7>:******************\n">; printf<"\t请输入:">; scanf<"%d",&number>; fflush<stdin>; while<i> { switch<number> { case1: add_score<count>; /*添加学生成绩函数*/ printf<" 提示:按Y退出学生成绩管理界面,按N重新录入学生成绩!!!\n">; i=yes_no_return<>; system<"cls">; break; case2: xiugai_score<count>; /*修改学生成绩函数*/ printf<" 提示:按Y退出学生成绩录入界面,按N重新修改学生成绩!!!\n">; i=yes_no_return<>; system<"cls">; break; case3: shanchu_score<count>; /*删除学生成绩函数*/ printf<" ">; system<"pause">; system<"cls">; break; case4: chaxun_score<count>; /*按要求查询学生成绩函数*/ printf<" 提示:按Y退出学生成绩管理界面,按N返回学生成绩管理界面!!!\n">; i=yes_no_return<>; system<"cls">; break; case5: paixu_score<count>; /*学生成绩排序函数*/ printf<" 提示:按Y退出学生成绩管理界面,按N返回学生成绩管理界面!!!\n">; i=yes_no_return<>; system<"cls">; break; case6: tongji_score<count>; /*学生成绩统计函数*/ printf<" 提示:按Y退出学生成绩管理界面,按N返回学生成绩管理界面!!!\n">; i=yes_no_return<>; system<"cls">; break; case7: system<"cls">; break; default: printf<"请正确输入1-7:">; system<"cls">; } }}voidadd_score<intcount> /*添加学生成绩函数*/{ system<"cls">; intk; for<k=0;k<count;k++> { printf<"\n\n">; printf<"\t请输入第%d位同学的各科成绩:\n",k+1>; printf<"\t\t请录入学号为%d的学生的语文分数:",our_student[k].student_id>; scanf<"%f",&our_student[k].chinese>; printf<"\n">; printf<"\t\t请录入学号为%d的学生的英语分数:",our_student[k].student_id>; scanf<"%f",&our_student[k].english>; printf<"\n">; printf<"\t\t请录入学号为%d的学生的计算机分数:",our_student[k].student_id>; scanf<"%f",&our_student[k].computer>; printf<"\n">; printf<"\t\t请录入学号为%d的学生的数学分数:",our_student[k].student_id>; scanf<"%f",&our_student[k].math>; printf<"\n">; printf<"\t\t请录入学号为%d的学生的体育分数:",our_student[k].student_id>; scanf<"%f",&our_student[k].PE>; our_student[k].sum=our_student[k].chinese+our_student[k].english+our_student[k].computer+our_student[k].math+our_student[k].PE; }}voidxiugai_score<intcount> /*修改学生成绩函数*/{ intnumber,i; system<"cls">; printf<"\n\n">; printf<" ☆请输入需要修改成绩的学生的学号:">; scanf<"%d",&number>; printf<"\n">; while<1> { if<<number>=20150000>&&<number<=count>> { printf<" ☆您输入的学号正确!可以进行修改处理。\n\n">; break; } else { printf<" ☆您输入的学号有问题,请重新输入要修改成绩的学号!!!\n\n">; printf<" ☆请输入需要修改成绩的学生的学号:">; scanf<"%d",&number>; } } fflush<stdin>; for<i=0;our_student[i].student_id==number;i++> { printf<"\n请输入需要修改的语文成绩:">; scanf<"%f",&our_student[i].chinese>; printf<"\n请输入需要修改的英语成绩:">; scanf<"%f",&our_student[i].english>; printf<"\n请输入需要修改的数学成绩:">; scanf<"%f",&our_student[i].math>; printf<"\n请输入需要修改的计算机成绩:">; scanf<"%f",&our_student[i].computer>; printf<"\n请输入需要修改的体育成绩:">; scanf<"%f",&our_student[i].PE>; our_student[i].sum=our_student[i].chinese+our_student[i].english+our_student[i].computer+our_student[i].math+our_student[i].PE; break; }}voidshanchu_score<intcount> /*删除学生成绩函数*/{ intnumber,i; system<"cls">; printf<"请输入需要删除成绩的学生的学号:">; scanf<"%d",&number>; while<1> { if<number>=20150000&&number<=count> { printf<"您输入的学号正确!可以进行修改处理。\n">; break; } else { printf<"您输入的学号有问题,请重新输入要修改成绩的学号!!!\n">; printf<"请输入需要修改成绩的学生的学号:">; scanf<"%d",&number>; } } printf<"您确定要将学号为%d的学生的成绩删除!!!\n",number>; printf<"1.是2.否\n">; scanf<"%d",&i>; switch<i> { case1: for<i=0;our_student[i].student_id==number;i++> { our_student[i].chinese=0; our_student[i].english=0; our_student[i].math=0; our_student[i].computer=0; our_student[i].PE=0; our_student[i].sum=0; printf<"\n">; printf<"您已将学号为%d的学生的成绩删除!!!\n",number>; printf<"****************************************\n">; printf<"*姓名:%s*\n",our_student[i].student_name>; printf<"*学号:%d*\n",our_student[i].student_id>; printf<"*年级:%d*\n",our_student[i].grade>; printf<"*语文成绩:%f*\n",our_student[i].chinese>; printf<"*英语成绩:%f*\n",our_student[i].english>; printf<"*数学成绩:%f*\n",our_student[i].math>; printf<"*计算机成绩:%f*\n",our_student[i].computer>; printf<"*体育成绩:%f*\n",our_student[i].PE>; printf<"*总分:%f*\n",our_student[i].sum>; printf<"****************************************\n">; break; } break; case2: break; default: break; }}voidchaxun_score<intcount> /*按要求查询学生成绩函数*/{ intnumber,i; system<"cls">; printf<"请输入需要查询的学生的学号:">; scanf<"%d",&number>; while<1> { if<number>=20150000&&number<=count> { printf<"您输入的学号正确!可以进行修改处理。\n">; break; } else { printf<"您输入的学号有问题,请重新输入要查询成绩的学号!!!\n">; printf<"请输入需要查询成绩的学生的学号:">; scanf<"%d",&number>; } } for<i=0;our_student[i].student_id==number;i++> { printf<"****************************************\n">; printf<"*姓名:%s*\n",our_student[i].student_name>; printf<"*学号:%d*\n",our_student[i].student_id>; printf<"*年级:%d*\n",our_student[i].grade>; printf<"*语文成绩:%f*\n",our_student[i].chinese>; printf<"*英语成绩:%f*\n",our_student[i].english>; printf<"*数学成绩:%f*\n",our_student[i].math>; printf<"*计算机成绩:%f*\n",our_student[i].computer>; printf<"*体育成绩:%f*\n",our_student[i].PE>; printf<"*总分:%f*\n",our_student[i].sum>; printf<"****************************************\n">; }}voidpaixu_score<intcount> /*学生成绩排序函数*/{}voidtongji_score<intcount> /*学生成绩统计函数*/{ system<"cls">; inti; printf<"**********************************************\n">; printf<"* 1.语文最高分*\n">; printf<"* 2.语文及格的人数*\n">; printf<"* 3.语文及格率*\n">; printf<"* 4.英语最高分*\n">; printf<"* 5.英语及格的人数*\n">; printf<"* 6.英语及格率*\n">; printf<"* 7.数学最高分*\n">; printf<"* 8.数学及格人数*\n">; printf<"* 9.数学及格率*\n">; printf<"* 10.计算机最高分*\n">; printf<"* 11.计算机及格的人数*\n">; printf<"* 12.计算机及格率*\n">; printf<"* 13.体育最高分*\n">; printf<"* 14.体育及格人数*\n">; printf<"* 15.体育及格率*\n">; printf<"*16.总成绩最高*\n">; printf<"**********************************************\n">; printf<"请选择统计条件:">; scanf<"%d",&i>; fflush<stdin>; if<i==1> { floata; a=chinese<count>; printf<"语文最高分为:%.2f",a>; } elseif<i==2> { intb; b=chr<count>; printf<"语文及格的人数为:%d",b>; } elseif<i==3> { intc; c=chr<count>; printf<"语文的及格率为:%.2f",float<c>/count>; } elseif<i==4> { floata; a=math<count>; printf<"数学最高分为:%.2f",a>; } elseif<i==5> { intb; b=mhr<count>; printf<"数学及格的人数为:%d",b>; } elseif<i==6> { intc; c=mhr<count>; printf<"数学的及格率为:%.2f",float<c>/count>; } elseif<i==7> { floata; a=english<count>; printf<"英语最高分为:%.2f",a>; } elseif<i==8> { intb; b=ehr<count>; printf<"英语及格的人数为:%d",b>; } elseif<i==9> { intc; c=ehr<count>; printf<"英语的及格率为:%.2f",float<c>/count>; } elseif<i==10> { floata; a=computer<count>; printf<"计算机最高分为:%.2f",a>; } elseif<i==11> { intb; b=thr<count>; printf<"计算机及格的人数为:%d",b>; } elseif<i==12> { intc; c=thr<count>; printf<"计算机的及格率为:%.2f",float<c>/count>; } elseif<i==13> { floata; a=PE<count>; printf<"体育最高分为:%.2f",a>; } elseif<i==14> { intb; b=phr<count>; printf<"体育及格的人数为:%d",b>; } elseif<i==15> { intc; c=phr<count>; printf<"体育的及格率为:%.2f",float<c>/count>; } elseif<i==16> { floata; a=sum_score<count>; printf<"总分最高为:%.2f",a>; } else { printf<"输入错误!!!\n">; }}floatchinese<intcount> /*计算语文成绩最大值函数*/{ floatmax; inti; max=our_student[0].chinese; for<i=0;i<count;i++> { if<max<our_student[i].chinese> { max=our_student[i].chinese; } } returnmax;}intchr<intcount> /*计算语文成绩及格人数的函数*/{ inti,a=0; for<i=0;i<count;i++> { if<our_student[i].chinese>=60> { a++; } } returna;}floatenglish<intcount> /*计算英语成绩最大值函数*/{ floatmax; inti; max=our_student[0].english; for<i=0;i<count;i++> { if<max<our_student[i].english> { max=our_student[i].english; } } returnmax;}intehr<intcount> /*计算英语成绩及格人数的函数*/{ inti,a=0; for<i=0;i<count;i++> { if<our_student[i].english>=60> { a++; } } returna;}floatmath<intcount> /*计算数学成绩最大值函数*/{ floatmax; inti; max=our_student[0].math; for<i=0;i<count;i++> { if<max<our_student[i].math> { max=our_student[i].math; } } returnmax;}intmhr<intcount> /*计算数学成绩及格人数的函数*/{ inti,a=0; for<i=0;i<count;i++> { if<our_student[i].math>=60> { a++; } } returna;}floatcomputer<intcount> /*计算计算机成绩最大值函数*/{ floatmax; inti; max=our_student[0].computer; for<i=0;i<count;i++> { if<max<our_student[i].computer> { max=our_student[i].computer; } } returnmax;}intthr<intcount> /*计算计算机成绩及格人数的函数*/{ inti,a=0; for<i=0;i<count;i++> { if<our_student[i].computer>=60> { a++; } } returna;}floatPE<intcount> /*计算体育成绩最大值函数*/{ floatmax; inti; max=our_student[0].PE; for<i=0;i<count;i++> { if<max<our_student[i].PE> { max=our_student[i].PE; } } returnmax;}intphr<intcount> /*计算体育成绩及格人数的函数*/{ inti,a=0; for<i=0;i<count;i++> { if<our_student[i].PE>=60> { a++; } } returna;}floatsum_score<intcount> /*计算总分成绩最大值函数*/{ floatmax; inti; max=our_student[0].sum; for<i=0;i<count;i++> { if<max<our_student[i].sum> { max=our_student[i].sum; } } returnmax;}intyes_no_return<>/*选择是否返回上一层*/{ charjude; printf<"\n 请输入:">; fflush<stdin>; scanf<"%c",&jude>; if<'Y'==jude> return0; else return1;}voidstudent_file1<> /*将保存的学生的账号密码存入文件中*/{inti,a; FILE*fp1; fp1=fopen<"student1.txt","r">; if<fp1==NULL> { fp1=fopen<"student1.txt","w">; } else { fclose<fp1>; fp1=fopen<"student1.txt","a">; } printf<"======================正在将学生帐号密码保存至文件======================\n">; printf<"\n 要添加的学生账号的个数为:">; scanf<"%d",&a>; printf<"\n">; for<i=0;i<a;i++> { printf<" ***********************************\n">; printf<"\n 请输入第%d个要添加的学生账号:",i+1>; scanf<"%d",&our_student[i].student_id>; printf<"\n 请输入学生密码:">; scanf<"%s",&our_student[i].password>; } for<i=0;i<a;i++> { fprintf<fp1,"%d",our_student[i].student_id>; fprintf<fp1,"%s",our_student[i].password>; } printf<" 添加成功!\n">; fclose<fp1>; printf<"\n ">; system<"pause">; system<"cls">;}voidstudent_file2<> /*将保存的学生的个人信息存入文件中*/{inti,a; FILE*fp1; fp1=fopen<"student2.txt","r">; if<fp1==NULL> { fp1=fopen<"student2.txt","w">; } else { fclose<fp1>; fp1=fopen<"student2.txt","a">; } printf<"======================正在将学生个人信息保存至文件======================\n">; printf<"\n 要添加的学生信息的个数为:">; scanf<"%d",&a>; printf<"\n">; for<i=0;i<a;i++> { fprintf<fp1,"%d",our_student[i].age>; fprintf<fp1,"%s",our_student[i].qq>; fprintf<fp1,"%s",our_student[i].tel>; fprintf<fp1,"%d",our_student[i].grade>; } printf<" 添加成功!\n">; fclose<fp1>; printf<"\n ">; system<"pause">; system<"cls">;}voidstudent_file3<> /*将保存的学生的成绩存入文件中*/{inti,a; FILE*fp1; fp1=fopen<"student3.txt","r">; if<fp1==NULL> { fp1=fopen<"student3.txt","w">; } else { fclose<fp1>; fp1=fopen<"student3.txt","a">; } printf<"=======================正在将学生成绩保存至文件=======================\n">; printf<"\n 要添加的学生成绩的个数为:">; scanf<"%d",&a>; printf<"\n">; for<i=0;i<a;i++> { fprintf<fp1,"%f",our_student[i].chinese>; fprintf<fp1,"%f",our_student[i].english>; fprintf<fp1,"%f",our_student[i].math>; fprintf<fp1,"%f",our_student[i].computer>; fprintf<fp1,"%f",our_student[i].sum>; } printf<" 添加成功!\n">; fclose<fp1>; printf<"\n ">; system<"pause">; system<"cls">;}voidteacher_file<> /*将保存的老师的账号密码存入文件中*/{inti,a; FILE*fp1; fp1=fopen<"teacher.txt","r">; if<fp1==NULL> { fp1=fopen<"teacher.txt","w">; } else { fclose<fp1>; fp1=fopen<"teacher.txt","a">; } printf<"======================正在将学生帐号密码保存至文件======================\n">; printf<"\n 要添加的老师账号的个数为:">; scanf<"%d",&a>; printf<"\n">; for<i=0;i<a;i++> { printf<" ***********************************\n">; printf<"\n 请输入第%d个要添加的老师账号:",i+1>; scanf<"%d",&our_teacher[i].teacher_id>; printf<"\n 请输入老师密码:">; scanf<"%s",&our_teacher[i].password>; } for<i=0;i<a;i++> { fprintf<fp1,"%d",our_teacher[i].teacher_id>; fprintf<fp1,"%s",our_teacher[i].password>; } fclose<fp1>; printf<"\n ">; system<"pause">; system<"cls">;}intshow_menu_register<> /*注册菜单*/{ intchoice; printf<"==========================欢迎使用熊智诚的教务系统==========================\n">; printf<"\n\n\n\n\n">; printf<"\t*********************教务管理系统注册界面********************\n">; printf<"\t*************************************\n">; printf<"\t*************************\n">; printf<"\t*******1.学生注册*******\n">; printf<"\t*********\n">; printf<"\t**2.管理员注册**\n">; printf<"\t*********\n">; printf<"\t*******3.退出注册*******\n">; printf<"\t**********

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论