#include
#include
using namespace std;
class Stud
{private:
int no;
char name;
float deg;
public:
static float sum;
static int num;
static float avg();
static void disp();
};
float Stud::sum=0.0;
int Stud::num=0;
Stud::Stud(int m,char n,float d)
{no=m;
name=n;
deg=d;
sum+=deg;
}
float Stud::avg()
{return sum/num;}
void Stud::disp()
{cout<<"学号:"<<no<<endl;
cout<<"姓名:"<<name<<endl;
cout<<"成绩:"<<deg<<endl;
cout<<"平均分:"<<avg()<<endl;
}
int main()
{
Stud s1(101,"Xiaoming",84),s2(102,"Xiaohong",94),s3(103,"Xiaofang",87);
s1.avg();
s1.disp();
s2.avg();
s2.disp();
s3.avg();
s3.disp();
return 0;
}