求2个学生平均分的类~哪出问题了??
#include<iostream.h>class Student
{
public:
Student(char x,int y,float z)
{
x=n;
y=no;
z=s;
t++;
g+=z;
}
friend void print()
{
cout<<g/t<<endl;
}
private:
static int t;
char n;
int no;
float s;
static float g;
};
float Student::g=0;
int Student::t=0;
void main()
{
char w,q;
Student s1(w,1,90.5),s2(q,2,80.5);
print();
}
想求这2个学生的平均分...貌似有点问题...~~~小弟刚学C++...请大家指点指点~~谢谢!