[求助]求助错在哪?(有关继承)
/*编写一个学生和教师数据输入和显示程序,学生数据有编号、姓名、班号和成绩,教师数据有编号、姓名、职称和部门。要求将编号、姓名输入和显示设计成一个类person,并作为学生数据操作类student和教师数
据操作类teacher的基类。*/
#include<iostream.h>
#include<string.h>
class Person
{
public:
int id;
char name[10];
void show(Student s)
{
s.set();
cout << id << endl;
cout << name << endl;
s.print();
}
};
class Student:public Person
{
public:
int classid;
double score;
void set()
{
cout << "请输入编号:" << endl;
cin >> classid;
cout << "请输入成绩:" << endl;
cin >> score;
}
void print()
{
cout << 编号:" << classid << endl;
cout << "成绩:" << score << endl;
}
};
class Teacher:public Person
{
public:
char zhichen[10];
char bumen[10];
};
void main()
{
Person a;
strcpy(a.name,"СÃ÷");
a.id=2;
Student s1;
a.show(s1);
}
//程序还没写完整 可是一直报错 达人帮忙指点下