成绩处理
来源:互联网 发布:重庆海普软件 编辑:程序博客网 时间:2024/04/29 04:05
/*小平帮老师处理期末成绩时遇到了问题。他需要计算每个同学的平均成绩,并判断他们是否通过了期末考试不及格成绩(<60),若都通过才能pass,若没通过要说明是哪几科未通过。因此他需要两个函数,一个求平均成绩(不考虑小数),另一个判断是否通过考试,通过输出pass,否则输出未通过的科目。请你们帮帮他!期末包括Chinese,Math,English三门课程。*/#include <iostream>using namespace std;class Average{public: void setNum(); void setScore(); void aveScore(); void display(); void compare();private: int Num; int Chinese; int Math; int English;};void Average::setNum(){ cin>>Num;}void Average::setScore(){ cin>>Chinese>>Math>>English;}void Average::aveScore(){ int i; i=(Chinese+Math+English)/3; cout<<i<<endl;}void Average::compare(){ if(Chinese>=60&&Math>=60&&English>=60) cout<<"pass"<<endl; if(Chinese<60) cout<<"Chinese"<<endl; if(Math<60) cout<<"Math"<<endl; if(English<60) cout<<"English"<<endl;}void Average::display(){ cout<<"student:"<<Num<<endl;}int main(){ Average a; a.setNum(); a.setScore(); a.display(); a.aveScore(); a.compare(); return 0;}
0 0
- 成绩处理
- 成绩处理
- 成绩处理
- 成绩处理
- 成绩处理
- 成绩处理
- 成绩处理
- 成绩处理
- 成绩处理
- 成绩处理
- 成绩处理。
- 成绩处理
- 成绩处理
- 成绩处理
- 成绩处理
- 成绩处理
- 成绩处理
- 成绩处理
- Java中的字符串驻留(String Interning)
- 探秘Java虚拟机——内存管理与垃圾回收
- leetcode - Sort Colors
- 一致性hash算法 - consistent hashing
- idea开发工具中你可能不知道的却又比较好用的快捷键
- 成绩处理
- Java 程序员在写 SQL 时常犯的 10 个错误
- acm~剪刀石头布
- maven打包可运行jar
- Ehcache和MemCached比较分析
- Java http请求获取ip地址
- ehcache memcache redis 三大缓存男高音
- memcache的最佳实践方案。
- ubuntu nodejs