奖学金计算系统源代码_第1页
奖学金计算系统源代码_第2页
奖学金计算系统源代码_第3页
奖学金计算系统源代码_第4页
奖学金计算系统源代码_第5页
已阅读5页,还剩3页未读 继续免费阅读

下载本文档

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

文档简介

1、精选文档奖学金计算系统要求:n 输入为某个学期某个班级某个专业的期末成果n 依据输入计算学分绩n 依据实际奖学金的评定规章,输出各等奖学金的获奖名单和人数#include<iostream>#include<math.h>#include<string>#include<fstream>using namespace std;static int n = 0;class exam /成果类public:float Math;float English;float Sport;float practise;float sum;class final

2、 : public exampublic:float grade(float a = 0, float b = 0, float c = 0, float d = 0);class midterm : public exampublic:float grade(float a = 0, float b = 0, float c = 0, float d = 0);float midterm:grade(float a, float b, float c, float d)sum = a + b + c + d;return a + b + c + d;float final:grade(flo

3、at a, float b, float c, float d)sum = a + b + c + d;return a + b + c + d;class student /同学类public:float pingding();string name; /姓名string number; /学号string major;/专业char sex5; /性别int money; /奖学金数额float GPA; /学分绩midterm first_grade; /上半年考试成果final second_grade; /下半年考试成果;float student:pingding()float a

4、, b;a = (second_grade.Math * 4 + second_grade.English * 3 + second_grade.Sport * 2 + second_grade.practise * 1.5) * 0.5 / 10.5;b = (first_grade.English * 3.5 + first_grade.Math * 4 + first_grade.practise * 1.5 + first_grade.Sport * 2) * 0.5 / 10.5;GPA = a + b;if (GPA >= 90)money = 3000;else if (G

5、PA >= 80 && GPA < 90)money = 1500;else if (GPA >= 75 && GPA < 80)money = 750;elsemoney = 0;return GPA;class guanlipublic:void print();int gameprint1();void fun1(student *stu);void paihang(student *stu);void find(student *stu);void amend(student *stu);void chushi(student *

6、stu);void guanli:print() /打印界面函数cout << "-" << endl;cout << "* 奖学金评定 *" << endl;cout << "* 1初始化同学信息 *" << endl;cout << "* 2查看奖学金信息 *" << endl;cout << "* 3查询个人奖学金 *" << endl;cout << &qu

7、ot;* 4修改个人成果 *" << endl;cout << "* 5退出 *" << endl;cout << "-" << endl;int guanli:gameprint1() /打印函数int a;cout << "连续操作请按1,退出请按0" << endl;cin >> a;return a;void guanli:chushi(student *stu) /初始化同学信息函数int i;for (i = 0; i

8、 < n; i+)stui.pingding();void guanli:fun1(student *stu) /录入同学信息函数float a, b, c, d, i;/数学, 英语,体育 ,实践,总成果cout << "输入同学姓名,学号,性别,专业" << endl;cin >> >> stun.number >> stun.sex >> stun.major;cout << "请选择输入" << <&

9、lt; "的成果" << endl;cout << "请输入该生上半年成果-请按-数学 英语 体育 实践 的挨次输入,否则默认为0" << endl;cin >> a >> b >> c >> d;stun.first_grade.Math = a;stun.first_grade.English = b;stun.first_grade.Sport = c;stun.first_grade.practise = d;stun.first_grade.grade(a, b

10、, c, d);cout << "请输入该生下半年成果-请按-数学 英语 体育 实践 的挨次输入,否则默认为0" << endl;cin >> a >> b >> c >> d;stun.second_grade.Math = a;stun.second_grade.English = b;stun.second_grade.Sport = c;stun.second_grade.practise = d;stun.second_grade.grade(a, b, c, d);n+;void guanl

11、i:paihang(student *stu) /查看奖学金信息函数int i;cout << "姓名" << " " << "学分绩" << " " << "奖学金数额" << endl;for (i = 0; i < n; i+)stui.pingding();bool finish = false;int k = 1;while (k < n && !finish) finish = tru

12、e;for (int j = 0; j < n - k; j+)if (stuj.GPA < stuj + 1.GPA) swap(stuj + 1, stuj);finish = false;for (i = 0; i < n; i+)cout << << " " << stui.GPA << " " << stui.money << endl;void guanli:find(student *stu) /查询奖学金函数int a;float

13、 b;cout << "请输入所查询同学学号" << endl;string ch;cin >> ch;int i;for (i = 0; i < n; i+)if (ch = stui.number)b = stui.pingding();if (b >= 75 && b < 80)cout << "恭喜" << << "获得综合三等奖学金,数额为750" << endl;else if (b &

14、gt;= 80 && b < 90)cout << "恭喜" << << "获得综合二等奖学金,数额为1500" << endl;else if (b >= 90)cout << "恭喜" << << "获得综合一等奖学金,数额为3000" << endl;elsecout << "该生未获得奖学金,请连续努力" <

15、< endl;return;cout << "查无此人" << endl;void guanli:amend(student *stu) /修改同学成果函数string s;int i = 0, a, b;char ch;float aa;cout << "请输入修改同学的学号" << endl;cin >> s;for (i = 0; i < n; i+)if (stui.number = s)loop1:cout << "请输入要修改的成果" &l

16、t;< endl;cout << " 1上半年成果 " << endl;cout << " 2下半年成果 " << endl;cin >> a;if (a = 1)cout << "请输入要修改的学科" << endl;cout << " 1数学" << endl;cout << " 2英语" << endl;cout << " 3体育&

17、quot; << endl;cout << " 4实践" << endl;cin >> b;cout << "请输入修改后的成果" << endl;cin >> aa;switch (b)case 1:stui.first_grade.Math = aa;break;case 2:stui.first_grade.English = aa;break;case 3:stui.first_grade.Sport = aa;break;case 4:stui.first_gr

18、ade.practise = aa;break;else if (a = 2)cout << "请输入要修改的学科" << endl;cout << " 1数学" << endl;cout << " 2英语" << endl;cout << " 3体育" << endl;cout << " 4实践" << endl;cin >> b;cout << "请输入修改后的成果" << endl;cin >> aa;switch (b)case 1:stui.second_grade.Math = aa;break;case 2:stui.second_grade.English = aa;break;case 3:stui.second_grade.Sport = aa;break;case 4:stui.second_grade.

温馨提示

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

评论

0/150

提交评论