《数据结构与算法》课程设计
24、员工管理系统
问题描述: 每个员工的信息包括:编号、姓名、性别、出生年月、学历、职务、电话、住址等。系统能够完成员工信息的查询、更新、插入、删除、排序等功能。 实现要求: (1) 排序:按不同关键字,对所有员工的信息进行排序。 (2) 查询:按特定条件查找员工。 (3) 更新:按编号对某个员工的某项信息进行修改。 (4) 插入:加入新员工的信息。 (5) 删除:按编号删除已离职的员工的信息。
#include
#include
#include
#include
#include
using namespace std;
struct employee { //存储结构
string num; //编号
string name; //姓名
string gender; //性别
string birth; //出生日期
string education; //学历
string position; //职务
string phone; //电话
string address; //住址
};
employee em[1024];
int len = 0; //员工数量
int flag = 0; //控制系统是否退出
//初始化员工信息
void init(employee t[]) {
len++, t[1].num = "1", t[1].name = "张三", t[1].gender = "男", t[1].birth = "2001-01-01", t[1].education = "本科", t[1].position = "经理", t[1].phone = "13970959821", t[1].address = "北京";
len++, t[2].num = "2", t[2].name = "李四", t[2].gender = "女", t[2].birth = "2002-02-02", t[2].education = "大专", t[2].position = "策划", t[2].phone = "16846541231", t[2].address = "上海";
len++, t[3].num = "3", t[3].name = "王五", t[3].gender = "男", t[3].birth = "2003-03-03", t[3].education = "中专", t[3].position = "职工", t[3].phone = "18174085740", t[3].address = "广州";
len++, t[4].num = "4", t[4].name = "赵六", t[4].gender = "女", t[4].birth = "2004-04-04", t[4].education = "本科", t[4].position = "秘书", t[4].phone = "18670569826", t[4].address = "深圳";
}
//打印表头
void emOutTitle() {
cout |