作业4.21
来源:互联网 发布:长春java培训哪家好 编辑:程序博客网 时间:2024/05/16 17:00
编写一个程序,已有若干学生数据,包括学号,姓名,成绩,要求输出这些学生的数据并计算出学生人数和平均成绩。
#include<iostream>#include<string>using namespace std;class student{public:student(int num1,string name1,double score1){num=num1;name=name1;score=score1; count++;sum+=score1;aver=sum/count;}void show(){cout<<"num="<<num<<endl;cout<<"name="<<name<<endl;cout<<"score="<<score<<endl;}static void show1(){cout<<"the numbers of students:"<<count<<endl;cout<<"the aver score of students:"<<aver<<endl;}private:int num;string name;double score;static double sum;static int count;static double aver;};double student::sum=0.0;int student::count=0;double student::aver=0.0;int main(){student stu1(01,"wubeiren",98);stu1.show();student stu2(02,"lianjingxing",100);stu2.show();student stu3(03,"lvyingchuang",88);stu3.show();student::show1();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
- 作业
- 作业
- 作业
- 作业
- 作业
- 记录iOS学习之路,与大家共勉——20150520
- 黑马程序员---Objective-C autorelease
- 开灯问题 —— POJ 1218 THE DRUNK JAILER
- android mediaplayer 自定义 mediacontroller
- GDB 进行调试 使用心得
- 作业4.21
- Android下拉列表控件spinner-andoid学习之旅(十一)
- Array和ArrayList的区别
- TexLive+moderncv,打造你自己的简历
- 复杂链表的复制
- hdu1233---还是畅通工程 最小生成树(水)
- POJ 3264 Balanced Lineup(RMQ模板)
- P122.32
- MyBatis Generator常用配置说明