c++高手帮忙啊
来源:百度知道 编辑:UC知道 时间:2024/09/21 17:25:53
#include"iostream.h"
class student
{
int english,computer,total;
public:
void getscore();
void dispaly();
};
void student::getscore()
{cout<<"英语:";
cin>>english;
cout<<"计算机:";
cin>>computer;
}
void student::display()
{total=english+computer;
}
main()
{student s1,s2,s3;
s1.getscore();
s2.getscore();
s3.getscore();
s1.diapaly();
s2.diapaly();
s3.diapaly();
}
错误
C:\Documents and Settings\Administrator\桌面\d.cpp(17) : error C2039: 'display' : is not a member of 'student'
C:\Documents and Settings\Administrator\桌面\d.cpp(3) : see declaration of 'student'
C:\Documents and Settings\Administrator\桌面\d.cpp(18) : error C2065: 'total' : undeclared identifier
C:\Documents and Settin
class student
{
int english,computer,total;
public:
void getscore();
void dispaly();
};
void student::getscore()
{cout<<"英语:";
cin>>english;
cout<<"计算机:";
cin>>computer;
}
void student::display()
{total=english+computer;
}
main()
{student s1,s2,s3;
s1.getscore();
s2.getscore();
s3.getscore();
s1.diapaly();
s2.diapaly();
s3.diapaly();
}
错误
C:\Documents and Settings\Administrator\桌面\d.cpp(17) : error C2039: 'display' : is not a member of 'student'
C:\Documents and Settings\Administrator\桌面\d.cpp(3) : see declaration of 'student'
C:\Documents and Settings\Administrator\桌面\d.cpp(18) : error C2065: 'total' : undeclared identifier
C:\Documents and Settin
#include"iostream.h"
class student
{
int english,computer,total;
public:
void getscore();
void dispaly();
};
void student::getscore()
{cout<<"英语:";
cin>>english;
cout<<"计算机:";
cin>>computer;
}
void student::dispaly()
{total=english+computer;
cout<<"总成绩为:";
cout<<total;
cout<<endl;
}
void main()
{student s1;
s1.getscore();
s1.dispaly();
}
“display”多处打错
还有其他的自己对下拉