120页第四题
来源:互联网 发布:替天行道 网络用语 编辑:程序博客网 时间:2024/04/30 23:39
#include<iostream>#include<string>using namespace std;class student{public:student(int s){score=s;}void account(int j);static void sum();static void average();private:int score;static int total_score;static int count;}; void student::account(int j){score=j;total_score+=score;++count;}void student::sum(){cout<<"总人数:"<<count<<endl;cout<<"总成绩:"<<total_score<<endl;}void student::average(){int ave;ave=total_score/count;cout<<"平均分:"<<ave<<endl;}int student::total_score=0;int student::count=0;int main(){student s1(0);char sel; do{int j;cout<<"请输入学生成绩:"<<endl;cin>>j;s1.account(j); cout<<"是否要继续录入学生成绩?(Y/N):"; cin>>sel;}while(sel=='Y' || sel=='y' ); student::sum();student::average();return 0;}
0 0
- 120页第四题
- 第四章第四题
- 第四章第四题
- 第一章27页第四题
- 第四题
- 第四题
- 第四题
- 第四题
- 第四题
- 第四题
- 第四题
- 第四题
- 第四题
- 第四题
- 第四题
- 第四题
- 第四题
- 第四题
- 黑马程序员---Java之异常
- JAVA入门之Scanner扫描器
- Operation not allowed after ResultSet closed
- 黑马程序员——C语言总结之篇
- Spring MVC 针对我自学用到的一些注解和属性解释总结
- 120页第四题
- uva 11922 Permutation Transforme/splay tree
- Objective C基础(一)
- Android 开源框架Universal-Image-Loader完全解析(二)--- 图片缓存策略详解
- Android Fragment 基本介绍
- C++ 虚函数表解析
- Centos6.5下使用tcpdump抓包并用wireshark分析
- Linux Centos下软件的安装与卸载方法
- Gvim入门(1)——三种基本模式