C语言课程设计-学生综合测评系统_第1页
C语言课程设计-学生综合测评系统_第2页
C语言课程设计-学生综合测评系统_第3页
C语言课程设计-学生综合测评系统_第4页
已阅读5页,还剩21页未读 继续免费阅读

下载本文档

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

文档简介

1、课程设计报告课程名称C 语言程序设计课题名称学生综合测评系统专业通信工程班级1503学号2015014109, 2015014128姓名指导教师编写2016汤华贝,佘旭升,郭梦婷,雍甜甜毛德梅年 6 月一、需求分析一、问题描述:每个学生的信息为:学号、姓名、性别、家庭住址、联系电话、语文、数学、外语三门单科成绩、考试平均成绩、考试名次、同学互评分、品德成绩、任课教师评分、综合测评总分、综合测评名次。考试平均成绩、同学互评分、品德成绩、任课教师评分分别占综合测评总分的60%, 10%, 10%,20%。二、功能描述:A 、学生信息处理(1) 输入学生信息、学号、姓名、性别、家庭住址、联系电话,按

2、学号以小到大的顺序存入文件中。提示:学生信息可先输入到数组中,排序后可写到文件中。(2) 插入(修改)同学信息:提示:先输入将插入的同学信息,然后再打开源文件并建立新文件,把源文件和输入的信息合并到新文件中(保持按学号有序)若存在该同学则将新记录内容替换源内容,(3) 删除同学信息:提示:输入将删除同学号,读出该同学信息,要求对此进行确认,以决定是否删除将删除后的信息写到文件中。(4) 浏览学生信息:提示:打开文件,显示该文件的学生信息。B、学生数据处理:(1) 按考试科目录入学生成绩并且按公式:考试成绩(语文 +数学 + 外语) /3 计算考试成绩,并计算考试名次,提示:先把学生信息读入数组

3、,然后按提示输入每科成绩,计算考试成绩,求出名次,最后把学生记录写入一个文件中。(2) 学生测评数据输入并计算综合测评总分及名次。提示:综合测评总分(考试成绩)*0.6+ (同学互评分)*0.1+ 品德成绩 *0.1+ 任课老师评分 *0.2 。(3) 学生数据管理提示:输入学号,读出并显示该同学信息,输入新数据,将改后信息写入文件(4) 学生数据查询:提示:输入学号或其他信息,即读出所有数据信息,并显示出来。C、学生综合信息输出提示:输出学生信息到屏幕。三、算法提示:1、数据结构:结构体类型数组2、数据库结构:下表构成该系统的基本数据库。 CharCharstructint第2页共24页二总

4、体设计方案1.总体流程图开始初始化inti 函Welcome 函数输入浏览修改删除排名浏览全清除全查询排退出第3页共24页三程序源代码#include#include#define N 100void init();char welcome();void InputInfo();void view();void xiugai();void DeleteInfo();void paiming1(struct student_info student);void paiming2(struct student_info student);void ViewAll();void clean();vo

5、id PaimingView();void exits();struct student_info input();void SortInfo(struct student_info student);void ViewInfo(struct student_info *sp);void SaveStruct(struct student_info *sp,int size,int n,char filename20);第4页共24页void LoadStruct(struct student_info *sp,int size,int n,char filename20);void Save

6、Int(int *p,int size,int n,char filename20);void LoadInt(int *p,int size,int n,char filename20);int NumExist(struct student_info student,int num);struct student_infoint num;/学号char name6;/姓名char sex5;/ 性别char adress20;/家庭住址char tel10;/电话int chinese,math,english,huping,pingde,jiaoping,paiming1,paiming

7、2;/语文数学英语互评品德教评double ave,zhongping;struct student_info studentN;int counter,PM;void main()char select;init();/调用初始化函数while(1)select=welcome();第5页共24页switch(select)case 1:system(cls);InputInfo(); break;/选项 1: 输入学生信息case 2:system(cls);view(); break;/ / 选项 2: 浏览学生信息case 3:system(cls);xiugai(); break;/

8、选项 3: 修改学生信息case 4:system(cls);DeleteInfo(); break;/选项 4: 删除学生信息case 5:system(cls);paiming1(student);paiming2(student);PM=1;getchar();getchar();system(cls); break;/选项 5: 学生信息排名case 6:system(cls); ViewAll();break;/ 选项 6: 浏览全部学生信息case 7:system(cls); clean();break;/ 选项 7: 清除所有信息case 8:system(cls); Paim

9、ingView();break;/选项 8: 查询排名case 0:system(cls);exits(); break;/选项 9: 退出void init()FILE *fp;fp=fopen(counter.dat,rb);/ 打开计数变量counter文件if(fp!=NULL)/ 载入 counterfclose(fp);LoadInt(&counter,sizeof(counter),1,counter.dat);第6页共24页elsefp=fopen(counter.dat,wb);/ 若没有 counter文件,则创建一个, counter初始为 0 。fclose(fp);c

10、ounter=0;if(counter!=0)/载入学生数据LoadStruct(student,sizeof(struct student_info),counter,student_info.dat);char welcome()char select;while(1)system(cls);printf(tt欢迎使用学生信息管理系统n);printf(n);printf(1.录入学生信息nn);printf(2.浏览学生信息nn);printf(3.修改学生信息nn);printf(4.删除学生信息nn);printf(5.排名学生成绩nn);第7页共24页printf(6.浏览所有学生

11、信息nn);printf(7.清除所有数据nn);printf(8.查询排名nn);printf(0.退出nn);printf(输入相应的功能序号:);select=getchar();if(select=1|select=2|select=3|select=4|select=5|select=6|select=7|select=8|select=0)return select;system(cls);continue;void InputInfo()int i,n;printf(需要录入多少位学生的信息:);scanf(%d,&n);system(cls);for(i=1;i=n;i+)st

12、udentcounter=input();第8页共24页counter+;PM=0;SortInfo(student);SaveStruct(student,sizeof(struct student_info),counter,student_info.dat);SaveInt(&counter,sizeof(counter),1,counter.dat);void view()int i,num;printf(请输入需要游览的学生信息的学号:);scanf(%d,&num);getchar();if(i=NumExist(student,num)=-1)printf(不存在该学号,按回车键

13、返回.);getchar();system(cls);return;ViewInfo(&studenti);printf(n按回车键返回 .);getchar();第9页共24页system(cls);return;void xiugai()int i,num;char YN,select;printf(请输入需要修改的学生信息的学号:);scanf(%d,&num);getchar();if(i=NumExist(student,num)=-1)printf(不存在该学号 , 按回车键返回 .);getchar();system(cls);return;ViewInfo(&studenti)

14、;printf(是否要修改?(Y/N):);scanf(%c,&YN);getchar();if(YN !=Y& YN !=y)第10页共24页printf(修改取消 .);getchar();system(cls);return;system(cls);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(0.任课教师教师评分n);scanf(%c,&s

15、elect);switch(select)case 1:printf(修改学号 :);scanf(%d,&studenti.num);break;case 2:printf(修改性别 :);scanf(%s,&studenti.sex);break;case 3:printf(修改家庭住址 :);scanf(%s,&studenti.adress);break;case 4:printf(修改联系电话 :);scanf(%s,&studenti.tel);break;第11页共24页case 5:printf(修改语文成绩 :);scanf(%d,&studenti.chinese);brea

16、k;case 6:printf(修改数学成绩 :);scanf(%d,&studenti.math);break;case 7:printf(修改外语成绩 :);scanf(%d,&studenti.english);break;case 8:printf(修改同学互评分:);scanf(%d,&studenti.huping);break;case 9:printf(修改品德成绩 :);scanf(%d,&studenti.pingde);break;case 0:printf(修改任课教师评分:);scanf(%d,&studenti.jiaoping);break;SortInfo(st

17、udent);SaveStruct(student,sizeof(struct student_info),counter,student_info.dat);PM=0;getchar();printf(修改完成 .);getchar();system(cls);void DeleteInfo()int i,j,num;char YN;printf(请输入要删除的学生信息学号:);scanf(%d,&num);getchar();第12页共24页if(i=NumExist(student,num)=-1)printf(没有该学号 , 按回车键返回 .);getchar();system(cls

18、);return;ViewInfo(&studenti);printf(n确认删除 (Y/N):);scanf(%c,&YN);getchar();if(YN!=Y & YN!=y)printf(删除取消 .);elsefor(j=i;jcounter-1;j+)studentj=studentj+1;counter-;PM=0;第13页共24页SaveStruct(student,sizeof(struct student_info),counter,student_info.dat);SaveInt(&counter,sizeof(counter),counter,counter.dat)

19、;printf(删除完成 .);getchar();system(cls);void paiming1(struct student_info student)struct student_info *pN,*temp;int i,j;for(i=0;icounter;i+)pi=&studenti;for(i=0;icounter-1;i+)for(j=i+1;jave ave)temp=pi;pi=pj;pj=temp;第14页共24页for(i=0;ipaiming1=i+1;printf(平均分排名完成.n);void paiming2(struct student_info stud

20、ent)struct student_info *pN,*temp;int i,j;for(i=0;icounter;i+)pi=&studenti;for(i=0;icounter-1;i+)for(j=i+1;jzhongping zhongping)temp=pi;pi=pj;pj=temp;for(i=0;ipaiming2=i+1;printf(综合测评分排名完成.n);void ViewAll()int i;for(i=0;inum);getchar();if(NumExist(student,sp-num)!=-1)第18页共24页printf(该学号已存在 , 请重新输入 .)

21、;getchar();system(cls);continue;break;printf(录入姓名 :);gets(sp-name);printf(录入性别 :);gets(sp-sex);printf(录入家庭住址 :);gets(sp-adress);printf(录入联系电话 :);gets(sp-tel);printf(n接下来录入成绩n);printf(语文 :);scanf(%d,&sp-chinese);printf(数学 :);scanf(%d,&sp-math);printf(英语 :);scanf(%d,&sp-english);sp-ave=(sp-chinese+sp-

22、math+sp-english)/3.0;第19页共24页printf(同学互评 :);scanf(%d,&sp-huping);printf(品德分数 :);scanf(%d,&sp-pingde);printf(教师评价 :);scanf(%d,&sp-jiaoping);getchar();sp-zhongping=(sp-ave*0.6+sp-huping*0.1+sp-pingde*0.1+sp-jiaoping*0.2);printf(录入完毕,确认信息是否正确(Y/N);YN=getchar();getchar();if(YN=Y| YN=y)break;elseprintf(按

23、回车键重新录入信息。);getchar();system(cls);continue;system(cls);return stu;第20页共24页void SortInfo(struct student_info student)int i,j;struct student_info temp;for(i=0;icounter-1;i+)for(j=i+1;j=counter-1;j+)if(studenti.numnum,sp-name,sp-sex,sp-adress,sp-tel);printf(语文 t数学 t英语 t互评 t品德 t教评 n);printf(%dt%dt%dt%dt%dt%dtn,sp-chinese,sp-math,sp-english,sp-huping,sp-pingde,sp-jiaoping);第21页共24页printf(平均分 t综合分 n);printf(%.2ft%.2fn,sp-ave,sp-zhongping);if(PM=1)printf(平均分排名 t综合测评分排名n);printf(%dtt%dn,sp-paiming1,sp-paiming2);void SaveStruct(struct

温馨提示

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

评论

0/150

提交评论