没有合适的资源?快使用搜索试试~ 我知道了~
用C++编写一个教师和学生数据的输入和显示程序
需积分: 16 14 下载量 180 浏览量
2010-06-08
11:07:36
上传
评论 1
收藏 1KB TXT 举报
温馨提示
试读
3页
用C++编写一个教师和学生数据的输入和显示程序
资源推荐
资源详情
资源评论
#include<iostream.h>
#include<string.h>
class Student; //学生类
class Teacher; //教师类
class Person //人类
{
private:
int id;
char name[20];
public:
Person(int x,char *p)
{
id=x;
strcpy(name,p);
}
void show(Student s)
{
cout << "编号:" << id << endl;
cout << "姓名:" << name << endl;
cout << "班号:" << s.getclassid() << endl;
cout << "成绩:" << s.getscore() << endl;
}
void show(Teacher t) //show函数的重载
{
cout << "编号:" << id << endl;
cout << "姓名:" << name << endl;
cout << "职称:" << t.getzhicheng() << endl;
cout << "部门:" << t.getbumen() << endl;
}
};
#include<string.h>
class Student; //学生类
class Teacher; //教师类
class Person //人类
{
private:
int id;
char name[20];
public:
Person(int x,char *p)
{
id=x;
strcpy(name,p);
}
void show(Student s)
{
cout << "编号:" << id << endl;
cout << "姓名:" << name << endl;
cout << "班号:" << s.getclassid() << endl;
cout << "成绩:" << s.getscore() << endl;
}
void show(Teacher t) //show函数的重载
{
cout << "编号:" << id << endl;
cout << "姓名:" << name << endl;
cout << "职称:" << t.getzhicheng() << endl;
cout << "部门:" << t.getbumen() << endl;
}
};
资源评论
godwithmsl
- 粉丝: 1
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功