6、编写一个程序,输入3个学生的英语和计算机成绩,并按总分从高到低排序(要求设计一个学生类Student)。
程序如下:#include "stdafx.h"
#include
using namespace std;
class student
{private : float E;float C;
public:
student(float e,float c);
~student( ){ }
float getE( ){ return E;)
float getC( ){ return C;}
float total( ){ return (E+C);}
};
student::student(float e,float c)
{
E=e;
C=c;
}
void rank( float &x,float &y)
{
int i;
if(x>a>>b>>c>>d>>e>>f;
student A(a,b);
student B(c,d);
studenC(e,f);
int m,n,x;
m=A.total( );
n=B.total( );
x=C.total( );
rank(m,n);
rank(m,x);
rank(n,x);
cout<<m<<"
"<<n<<"
"<<x<<endl;
return 0;
}
总提示这种错误
C:\Program Files\Microsoft Visual Studio\MyProjects\werf\werf.cpp(18) : error C2535: '__thiscall student::student(float,float)' : member function already defined or declared
C:\Program Files\Microsoft Visual Studio\MyProjects\werf\werf.cpp(48) : fatal error C1004: unexpected end of file found
|