学生成绩管理系统设计与实现55.docx
《学生成绩管理系统设计与实现55.docx》由会员分享,可在线阅读,更多相关《学生成绩管理系统设计与实现55.docx(22页珍藏版)》请在得力文库 - 分享文档赚钱的网站上搜索。
1、河南工程学院高级程序设计语言课程设计成果报告学生成绩管理系统设计与实现float Chengji:getaver () float average;average=getsum ()/3;return average;)float Chengji:getshu()(float mz;mz=math*baif+mathp*(1-baif);return mz;float Chengji:getcpp()float cz;cz=cpp*baif+cppp*(l-baif);return cz;float Chengji:geteng()float ez;ez=english*baif+englis
2、hp*(l-baif);return ez;)注:数学平时成绩用mathp表示,数学总成绩用mz表示;其他科目同样如此。主函数是功能实现的模块。系统对数据的录入以及对输入数据的显示输出。case 1:char c;char name20;int number;float math, cpp, english, mathp, cppp, englishp, baif, mathz, cppz, engz, sum;docoutname;coutnumber;cout请输入数学成绩endl;cinmath;coutcpp;coutenglish;coutmathp;cout请输入c+平时成绩cpp
3、p;cout请输入英语平时成绩englishp;cout请输入成绩百分比(大于等于0小于等于1) baif;通过此程序可以实现学生数据的录入,由于一个班级,一个学校的学生的数 量不止一个,所以系统需要实现增加学生数据的功能。case 2: char name20;int number;float math, cpp, english, mathp, cppp, englishp, mathz, cppz, engz;char c;Docout请输入您要增加的学生的名字:endl;cinname;coutnumber;cout*请输入数学成绩endl;cinmath;cout请输入 c+成绩cp
4、p;coutenglish;cout请输入数学平时成绩mathp;coutcppp;cout*请输入英语平时成绩englishp;cout”请输入成绩百分比“baif;fstream outfile, infile;outf ile. open(/zf 1. txt, ios: :out | ios: :app);if(!file)(coutz/fl. txt can not open. n/z;return ;outf ilename,z 学号:number 数学成绩mathc+成绩:cpp外语成绩:english 数学平时成绩*mathp c+平时成绩。cppp 英语平时成绩 /zengl
5、ishpendl;outfile. close();infile, open(z,f 1. txt, ios: : in);if(!file)cout/zfl. txt can not open.n;return ;char h;while(infile, get(h)couth;coutendl;infile, close();j+;si=newChengji(number, name, math, cpp, english, mathp, cppp, englishp, baif, mathz, c ppz, engz);i+;cout”数据录入成功,想继续吗(y/n),c;由于学生数量较
6、多,需要录入的信息比拟多,有时候可能会出现输入错误的 情况,如果放弃所有数据,重新输入比拟麻烦,费工费时,如果能将错误的学生 信息删去,就能解决问题。case 3: /删除学生信息10 char c;string xingming, line, str, name;doifstream fin(f1.txt);fstream outfile (z/f2. txt,ios: : trunc | ios: :out);coutxingming;while(!fin. eof ()getline(fin, line);istringstream stream (line);name=line. su
7、bstr(0, line, find(z/ , 0);if (name!=xingming)outfilelineendl;outfile. close();fin. close ();fstream f(f1. txt,ios:trunc|ios:out);ifstream outf(f2. txt);foutf. rdbuf ();outf. close ();f. close ();coutc;如果录入的学生数据信息的错误并不是很大,如果将其全部删除反而有会麻 烦,所以系统需要实现能够修改学生信息的功能。case 4: 修改数据11string sname, line, str, nam
8、e;int nu;float eng, ma, com, map, cpp, engp;int flag;char c;if(i=0)(cout系统中没有输入数据,请先输入数据endl;break;do(flag=0;coutname;fstream fin(f1. txt,ios:in);of stream outf ile (/zf. txt,ios: : trunc | ios: :out);coutendl;while(!fin. eof ()getline(fin, line);istringstream stream(line);sname=line. substr(0, line
9、. find(,0);if (name!=sname)(outfilelinenamenumacomengmapcppengp; coutendl;outfilename,/学号:数学成绩: c+成绩0com 外语成绩eng 数学平时成绩*map c+平时成绩。cpp 英语平时成绩 zzengpendl;outfile. close();fstream outf (zzf 1. txt,ios: : trunc | ios: :out);fstream inf (f. txt,ios:in);outfinf. rdbuf()endl;outf. close ();inf. close ();学
10、生数据信息全部录入完毕以后,要求使用者可以通过录入的学生信息来进 行信息查询,例如通过总分查询或者是姓名查询,这就要求系统有相应的查询功 能。按照总分数进行信息查询。case 5: 按总分查询(int j=0;float SUM;char c;int flag;if (i=0) cout”系统中没有输入数据,请先输入数据! “endl;break;do13 flag=O;cout请输入您要查询的学生的总成绩:“endl;cinSUM;for(int j=0;jgetsum()=SUM)flag=l;cout”您要查询的学生是: (*sj). nameendl;cout“该生的信息为:endl;
11、cout/,学号:num“数学分数:“(*sj). math*(*sj). baif+(*sj). mathp*(l-(*sj). baif),z c+分数, (*sj). cpp*(*sj). baif+(*sj). cppp*(l-(*sj). baif) 英 语分数(*sj). english*(*sj). baif+(*sj). englishp*(l-(*sj). baif) endl;输入姓名,查询相应的数据信息。case 6: 按姓名查询char n20;char c;int j=0;int flag;if (i=0)(cout系统中没有输入数据,请先输入数据! endl;bre
12、ak;do14 flag=O;cout请输入要查询的名字endl;cinn;for(int j=0;ji;j+)if (n= (*sj). name)(flag=l;cout。该生的信息为:学号:(*sj).num数学分数:“(*sj). math*(*sj). baif+(*sj). mathp*(1-(*sj). baif)c+分数(*sj). cpp*(*sj). baif+(*sj). cppp*(1-(*sj). baif),z 英 语分数“ (*sj). english*(*sj). baif+(*sj). englishp*(1-(*sj). baif) endl;一个完整的学生
13、管理系统,不仅能执行上面的各种功能,还要能够将学生的 数据信息进行输出,展现在大家眼前,使大家都能看到。case 7: 输出所有学生数据cout“所有学生数据如下:endl;ifstream file;file, open(f 1. txt, ios: : in);coutfile. rdbuf();file, close();break;15为了使学生数据更加清晰明了,方便对学生成绩进行比拟,了解学生的学习 状况,可以对学生的平均成绩以及各学科不及格的人数进行统计。统计每个学生的平均成绩。case 8: if (i=0)cout。系统中没有输入数据,请先输入数据!0endl;break;fo
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 学生 成绩管理系统 设计 实现 55
限制150内