请各位c++高手帮我看看我的程序错在那里了?

来源:百度知道 编辑:UC知道 时间:2024/05/29 18:14:55
我的程序在编译和连接时都没有错(编译环境visual c++ 6.0),但是在输出结果后就会出错.请各位高手帮帮忙,谢谢啦!
#include<iostream.h>
#include<string.h>
class Person
{
public:
Person();
void display();
private:
char num[11],name[11];
};
class Teacher:public Person
{
public:
Teacher();
~Teacher();
void display(Teacher s);
private:
char *bm,*zc;
};
Person::Person()
{
char *p,*q;
p=new char[11];
q=new char[11];
cout<<"input the person's num and name"<<endl;
cin>>p>>q;
strcpy(num,p);
strcpy(name,q);
}
void Person::display()
{
cout<<"The number:"<<num<<endl;
cout<<"The name:"<<name<<endl;
}

Teacher::Teacher()
{
char *b,*z;
b=new char[11];
z=new char[11];
cout<<"input the teacher's bumen zhichen&quo

#include<iostream>
#include<string>
using namespace std;
class Person
{
public:
Person();
void display();
private:
char num[11],name[11];
};
class Teacher:public Person
{
public:
Teacher();
~Teacher();
void display();
private:
char *bm,*zc;
};
Person::Person()
{
char *p,*q;
p=new char[11];
q=new char[11];
cout<<"input the person's num and name"<<endl;
cin>>p>>q;
strcpy(num,p);
strcpy(name,q);
}
void Person::display()
{
cout<<"The number:"<<num<<endl;
cout<<"The name:"<<name<<endl;
}

Teacher::Teacher()
{
char *b,*z;
b=new char[11];
z=new char[11];
cout<<"input the teacher's bumen zhichen"<<endl