C++ 用输入流实现人员信息的录入

来源:百度知道 编辑:UC知道 时间:2024/06/05 19:44:57
用输入流实现人员信息的录入。人员包括:员工(姓名,性别,年龄),主任(姓名,部门,级别),厂长(姓名,年龄)。

//用输入流实现人员信息的录入。人员包括:员工(姓名,性别,年龄),主任(姓名,部门,级别),厂长(姓名,年龄)。

#include <iostream.h>

class employee//员工类
{
private:
char name[20];
int age;
char sex[10];
public:
void streamInput()
{
cout<<"=============Employee=============\n";
cout<<"Please input employee's name:";
cin>>name;
cout<<"Please input employee's age:";
cin>>age;
cout<<"Please input employee's sex:";
cin>>sex;
}
};

class director//主任类
{
private:
char name[20];
char rank[10];
char dep[10];
public:
void streamInput()
{
cout<<"=============Director=============\n";
cout<<"Please input director's name:";
cin>>name;
cout<<"Please input director's rank:";