有关类的问题
#include<iostream.h>class tstudentscore
{
public:
tstudentscore()
{
no=1000;
chinese=100;
math=99;
english=99.5;
sum=chinese+math+english;
}
tstudentscore(int a)
{
no=1000;
chinese=100;
math=99;
english=99.5;
avg=(chinese+math+english)/3;
}
void coutprivatevalue();
void coutsumresultvalue();
void coutavgresultvalue();
private:
int no;
float chinese,math,english,sum,avg;
};
void tstudentscore::coutprivatevalue()
{
cout<<"no="<<no<<endl;
cout<<"chinese="<<chinese<<endl;
cout<<"math="<<math<<endl;
cout<<"english="<<english<<endl;
}
void tstudentscore::coutsumresultvalue()
{
cout<<"sum="<<sum<<endl;
}
void tstudentscore::coutavgresultvalue()
{
cout<<"avg="<<avg<<endl;
}
main()
{
cout<<"******************************************"<<endl;
cout<<"** 定义构造函数 **********"<<endl;
cout<<"******************************************"<<endl;
tstudentscore score1();
tstudentscore score2(1);
score1.coutprivatevalue();
score1.coutsumresultvalue();
score2.coutavgresultvalue();
cout<<"******************************************"<<endl;
}
红色的提示有错,但是不知道错在哪里。帮我看看啊!