为什么我的代码编译的时候没有任何错误,但是为什么就是不能运行呢?请高手指点下,谢谢!!!
#include<iostream.h>
class chengji
{
int id;
char *name;
public:
float score[3]; //score[0]数学,score[1]英语,score[2]物理
void zongfen(float *score)
{
cout<<this->name<<score[0]<<endl<<score[1]<<endl<<score[2]<<endl;
cout<<"最高分"<<(score[0]+score[1]+score[2]);
};
chengji(int a,char *p);
};
class chengji::chengji(int a,char *p)
{id=a;name=p;};
void main()
{
chengji a(12,"xiaoyu");
chengji b(22,"xiaoqiang");
chengji c(21,"zhang3");
a.score[0]=77;
a.score[1]=66;
a.score[2]=55;
a.zongfen(a.score);
b.score[0]=77;
b.score[1]=45;
b.score[2]=99;
b.zongfen(b.score);
c.score[0]=12;
c.score[1]=63;
c.score[2]=88;
c.zongfen(c.score);
}
[此贴子已经被作者于2006-10-27 23:27:54编辑过]