帮我看一下下面的代码有什么错误(我很怀疑是我的VC 6.0出了问题, 刚学c++)
#include
using namespace std;
class cperson
{public:
cperson()
{ name=sex=nomber=NULL;
}
void input()
{ cout<<"\n请输入姓名: \t";
cin>>name;
cout<<"\n请输入性别:\t";
cin>>sex;
cout<<"\n 请输入编号:\t";
cin>>nomber;
}
void output()
{ cout<<"\n姓名是:\t"< cout<<"\n性别是:\t"< cout<<"\n编号是:\t"<}
private:
char *name ;
char *nomber ;
char *sex ;
};
class cstudent : public cperson
{public:
cstudent():cperson()
{int i = 0;
cout<<"\n 输入三门成绩\n";
while(i < 3)
{cout<<"第"<<(i+1)<<"门成绩为\t";
cin>>score[i];
i++;
}
}
void outputscore()
{cout<<"\n 三门成绩分别为:\n";
cout<}
private:
float score[3];
};
void main(void)
{cstudent stu;
stu.input();
stu.output();
stu.outputscore();
}
--------------------next---------------------
#include
using namespace std;
class cperson
{public:
cperson()
{ char name[5],sex[3];
int nomber[7];
}
void input()
{ cout<<"\n请输入姓名: \t";
cin>>name;
cout<<"\n请输入性别:\t";
cin>>sex;
cout<<"\n 请输入编号:\t";
cin>>nomber;
}
void output()
{ cout<<"'\n*********************信息为******************"< cout<<"\n姓名是:\t"< cout<<"\n性别是:\t"< cout<<"\n编号是:\t"<}
private:
char name[5] ;
char nomber[7] ;
char sex[5] ;
};
class cstudent : public cperson
{public:
cstudent():cperson()
{int i = 0;
cout<<"\n**********************************************************";
cout<<"\n 输入三门成绩\n";
while(i < 3)
{
cout<<"第"<<(i+1)<<"门成绩为\t";
cin>>score[i];
i++;
}
}
void outputscore()
{
cout<<"成绩为\t"<}
private:
float score[3];
};
void main(void)
{cstudent stu;
cout<<"\n**************** 输入信息为:**********************\n";
stu.input();
stu.output();
stu.outputscore();
cout<<"\n*********************************************\n"<}
--------------------next---------------------
阅读(1253) | 评论(0) | 转发(0) |