作业4.21
来源:互联网 发布:jdbc mysql陶伟基 编辑:程序博客网 时间:2024/06/06 02:00
#include <iostream>#include <string>using namespace std;class student{private:int number;string name;float score;static int sum;static float total;static float average;public:student(int number1,string name1,float score1);void show();static void show_sum_ave();};student::student(int number1,string name1,float score1){number=number1;name=name1;score=score1;++sum;total=total+score;average=total/sum;}void student::show(){cout<<"学号:"<<number<<"姓名"<<name<<"分数"<<score<<endl;}void student::show_sum_ave(){cout<<"学生总人数:"<<sum<<endl;cout<<"平均成绩:"<<average<<endl;cout<<"总成绩:"<<total<<endl;}int student::sum=0;float student::average=0.0;float student::total=0.0;int main(){student s1(1,"linminyi",87);s1.show();student s2(2,"zhuangzihui",88);s2.show();student s3(3,"zhaoqiqini",89);s3.show();s3.show_sum_ave();return 0;}
0 0
- 作业4.21
- 作业4.21
- 作业4.21
- 作业4.21
- 作业4.21
- 作业4.21
- 作业4.21
- 作业4.21~4.22
- 第四章作业4.21
- C++作业4.21
- C++作业4.21
- 第四章作业4.21
- 第四章作业4.21
- 作业
- 作业
- 作业
- 作业
- 作业
- MQX的启动过程
- MVC模式和三层架构模式区别
- oracle直接执行程序块
- Update
- freemarker 对null 的处理
- 作业4.21
- 解决make zImage时出现的Clock skew detected问题
- ObjC继承中判断类归属的问题
- 图解STM32 JLink 采用JTAG 模式和 SWD模式下载时引脚说明
- BeanUtils 的使用步骤
- LoadRunner - Browser Emulation
- 《雪国》&《湖》读后感
- 黑马程序员——c语言基础:函数
- bochs配置文件的一些说明