c++编写职员信息(姓名排序)的类

#include<iostream>
#include<string>
using namespace std;
class staff
{
private:
 string name;
 string sex;
 int age;
 long num;
 string address;
 staff *next;
 staff *head;
 staff *p;
 staff *newp;
public:
 staff()
 {
   head=newp=this;
 }

 staff * search(staff *head,string key)//查找大于key的节点的前驱
 {
        staff *p;
  p=head;
  while (p->next !=NULL)
  {
   if(p->next->name>key)
    return p;
   p=p->next ;
  }
       return p;
 }
 void insert(staff *p,staff *newp)//插入节点
 {
 
  newp->next=p->next;
  p->next=newp;
 }


 //建立链表输入员工信息
 staff * creat()
 {
 
   int r;
   if((newp=new staff())==NULL)
   {
    cout<<"new

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
【员工管理系统】 问题描述:每个员工的信息包括:编号、姓名、性别、出生年月、学历、职务、电话、住址等。系统能够完成员工信息的查询、更新、插入、删除、排序等功能。 基本要求:排序:按不同关键字,对所有员工的信息进行排序;查询:按特定条件查找员工;更新,按编号对某个员工的某项信息进行修改;插入,加入新员工的信息;删除,按编号删除已离职的员工的信息。 选作内容:实现图形用户界面。 通过链表实现 数据结构: #include #include #include #include #include using namespace std; typedef struct workers{ char name[15];//姓名 char department[18];//单位 char gender;//性别 unsigned int age;//年龄 unsigned long long telephone;//电话 unsigned long wage;//工资 unsigned long num;//职工号 struct workers *next; }*Linklist,Lnode; void frist_print() { printf("\t\t⊙▽⊙ ⊙▽⊙ ⊙▽⊙ ⊙▽⊙ ⊙▽⊙ ⊙▽⊙ \n\n"); printf("\t\t\t欢迎进入员工管理系统\n"); } void menu() { printf("\n\t\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n"); printf("\t\t \t ◎1.创建员工信息\t \n"); printf("\t\t \t ◎2.插入员工信息\t \n"); printf("\t\t \t ◎3.修改员工信息\t \n"); printf("\t\t \t ◎4.删除员工信息\t \n"); printf("\t\t \t ◎5.查询员工信息\t \n"); printf("\t\t \t ◎6.员工信息排序\t \n"); printf("\t\t \t ◎7.显示员工信息\t \n"); printf("\t\t \t ◎8.员工工资情况\t \n"); printf("\n\t\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n"); printf("注意:输入均以回车作为结束\n"); printf("please choise 1--8:\t "); //putchar(12); } void Inset(Linklist Head){ Linklist s,L; unsigned int agee; unsigned long wagee,numm;

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值