为什么编译、联接都没问题,但最后说不能"written"?谢谢帮忙!
#include <iostream>using namespace std;
class Stu
{
public:
char *name;
double score;
Stu(char *x,double y)
{
*name=*x;
score=y;
}
friend int bijiaoda(int a,int b)
{
int max;
if(a>b)
max=a;
else
max=b;
return max;
}
friend int bijiaoxiao(int c,int d)
{
int min;
if(c<d)
min=c;
else
min=d;
return min;
}
};
void main ()
{
int max1,max2,max3,max4,min1,min2,min3,min4;
char a[6]="zhang",b[5]="wang",c[5]="zhao",d[3]="li",e[5]="chen";
char *f=&a[0],*g=&b[0],*h=&c[0],*i=&d[0],*j=&e[0];
Stu s1(f,78),s2(g,80),s3(h,92),s4(i,65),s5(j,50);
max1=bijiaoda(s1.score,s2.score);
max2=bijiaoda(max1,s3.score);
max3=bijiaoda(max2,s4.score);
max4=bijiaoda(max3,s5.score);
cout<<"这五个学生中的最高分是:"<<max4;
min1=bijiaoxiao(s1.score,s2.score);
min2=bijiaoxiao(min1,s3.score);
min3=bijiaoxiao(min2,s4.score);
min4=bijiaoxiao(min3,s5.score);
cout<<"这五个学生中的最低分是:"<<min4;
}