作业4,21
来源:互联网 发布:投影仪 网络接口 编辑:程序博客网 时间:2024/05/16 13:00
#include<iostream>#include<string>using namespace std;class student{private:int number;string name;float score;static int count;static float sum;static float ave;public:student(int num,string n,float sc);void show(){cout<<"学号:"<<number<<endl; cout<<"姓名:"<<name<<endl; cout<<"成绩:"<<score<<endl;}void show_count_ave(){cout<<"学生人数:"<<count<<endl;cout<<"平均成绩:"<<ave<<endl;}};student::student(int num,string n,float sc){number=num;name=n;score=sc;++count;sum=sum+score;ave=sum/count;}int student::count=0;float student::sum=0.0;float student::ave=0.0;int main(){student stu1(101,"liming",88);stu1.show();stu1.show_count_ave();student stu2(102,"chenhua",79);stu2.show(); stu2.show_count_ave();student stu3(101,"wuyan",95);stu3.show();stu3.show_count_ave();return 0;}
0 0
- 作业4,21
- 作业:C++作业4
- 作业:C++作业4
- 作业:C++作业4
- 作业4
- 作业4
- 作业4
- 作业4
- 作业4
- 作业4
- 作业4
- 作业4
- 作业4
- 作业4
- 作业4
- 作业4
- 作业4
- 作业4
- 版本控制(3)-- eclipse插件演示
- Android视频播放器
- [前端] js实现动态元素创建
- 跟韦老师学习嵌入式-LED总结
- EditText边框设置,获得焦点颜色变深,失去变浅
- 作业4,21
- 互联网金融-众筹网站收集(转)
- linux下mysql数据的导出和导入
- JS 日期格式化 字符串
- 裸奔和rtos下开发的差异分析
- POJ 2513 Colored Sticks 欧拉路的判断+字典树
- App Store加快上架方法
- 修改网页页面内容
- Unity 物理引擎实现匀速圆周运动