教学文库网 - 权威文档分享云平台
您的当前位置:首页 > 范文大全 > 文秘资料 >

c++员工档案管理系统

来源:网络收集 时间:2026-10-02
导读: 系别: 学号: 姓名: 程序如下: #include string.h #include malloc.h #include iostream.h #include conio.h typedef struct node { char n[20];//姓名 char wid[20];//工作证号 char sex[5]; char tel[10]; char ID[20]; char position[20];//职务 char

系别:

学号:

姓名:

程序如下:

#include <string.h>

#include <malloc.h>

#include <iostream.h>

#include <conio.h>

typedef struct node

{ char n[20];//姓名

char wid[20];//工作证号

char sex[5];

char tel[10];

char ID[20];

char position[20];//职务

char salary[10];

char birth[20];

char depart[20];//部门

char addr[35];

struct node *next;

}NODE;

class employee

{

private:

NODE *p;

NODE *q;

NODE *t;

public:

employee(NODE *m);

void add();

void printall();

void print();

void deleteall();

void edit();

void del();

};

employee::employee(NODE *m)

{ t=p=m;

}

void employee::del()

{ NODE *k;

k=new NODE;

k=p=q;

char n[20];

cout<<"请输入工作证号:"<<endl;

cin>>n;

while (p!=t&&(strcmp(p->wid,n)!=0)!=0)

{k=p;

p=p->next;

}

if (p==t)

{cout<<"查无此人!!"<<endl;

}

else

{if (p==q)

q=q->next;

else

k->next=p->next;

free(p);

}

}

void employee::print() { p=q;

char n[20];

cout<<"请输入工作证号:"<<endl;

cin>>n;

while (p!=t&&(strcmp(p->wid,n)!=0)!=0)

{p=p->next;

}

if (p==t)

{cout<<"查无此人!!"<<endl;

}

else

{ cout<<"姓名:"<<p->n<<endl;

cout<<"工作证号:"<<p->wid<<endl;

cout<<"性别:"<<p->sex<<endl;

cout<<"家庭电话:"<<p->tel<<endl;

cout<<"身份证号:"<<p->ID<<endl;

cout<<"职务:"<<p->position<<endl;

cout<<"薪水:"<<p->salary<<endl;

cout<<"生日:"<<p->birth<<endl;

cout<<"部门:"<<p->depart<<endl;

cout<<"家庭住址:"<<p->addr<<endl;

}

cout<<"按任意键返回!!"<<endl;

}

void employee::edit()

{

p=q;

char n[20];

cout<<"请输入员工作证号:"<<endl; cin>>n;

while (p!=t&&(strcmp(p->wid,n)!=0)!=0) {p=p->next;

}

if (p==t)

{cout<<"查无此人!!"<<endl;

}

else

{cout<<"姓名";

cin>>p->n;

cout<<"工作证号:";

cin>>p->wid;

cout<<"性别:";

cin>>p->sex;

cout<<"家庭电话:";

cin>>p->tel;

cout<<"身份证号:";

cin>>p->ID;

cout<<"职务:";

cin>>p->position;

cout<<"薪水:";

cin>>p->salary;

cout<<"生日:";

cin>>p->birth;

}

cout<<"按任意键返回!!"<<endl;

}

void employee::add()

{

q= new NODE;

q->next=p;

p=q;

cout<<"姓名:";

cin>>q->n;

cout<<"工作证号:";

cin>>q->wid;

cout<<"性别:";

cin>>q->sex;

cout<<"家庭电话:";

cin>>q->tel;

cout<<"身份证号:";

cin>>q->ID;

cout<<"职务:";

cin>>q->position;

cout<<"薪水:";

cin>>q->salary;

cout<<"生日:";

cin>>q->birth;

cout<<"家庭住址:";

cin>>q->addr;

cout<<"部门:";

cin>>q->depart;

cout<<"按任意键返回!!"<<endl;

}

void employee::printall()

{

p=q;

while (q!=t)

{

cout<<"姓名:"<<q->n<<endl;

cout<<"工作证号:"<<q->wid<<endl; cout<<"性别:"<<q->sex<<endl;

cout<<"家庭电话:"<<q->tel<<endl;

cout<<"身份证号:"<<q->ID<<endl;

cout<<"职务:"<<q->position<<endl;

cout<<"薪水:"<<q->salary<<endl;

cout<<"生日:"<<q->birth<<endl;

cout<<"家庭住址:"<<q->addr<<endl; cout<<"部门:"<<q->depart<<endl;

q=q->next;

// getch();

}

q=p;

}

void employee::deleteall()

{

while (q!=t)

{p=q;

q=q->next;

free(p);

}

cout<<"所有信息已删除!" ;

}

void display()

{

cout<<"\n 1:增加一个新成员!"<<endl; cout<<"\n 2:修改成员信息!"<<endl; cout<<"\n 3:查找成员信息!"<<endl; cout<<"\n 4:显示所有成员信息!"<<endl; cout<<"\n 5:删除成员信息!"<<endl; cout<<"\n 6:删除所有成员信息!"<<endl; cout<<"\n 7:退出!"<<endl;

}

void main() {

NODE *pa;

char i;

pa=(NODE*)malloc(sizeof(struct node)); display();

employee a(pa);

while(i=getch())

{

switch(i)

{

case'1':a.add();getch();display();break; case'2':a.edit();getch();display(); …… 此处隐藏:759字,全部文档内容请下载后查看。喜欢就下载吧 ……

c++员工档案管理系统.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.jiaowen.net/fanwen/737165.html(转载请注明文章来源)
Copyright © 2020-2025 教文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:78024566 邮箱:78024566@qq.com
苏ICP备19068818号-2
Top
× 游客快捷下载通道(下载后可以自由复制和排版)
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150份
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150份
全站内容免费自由复制
注:下载文档有可能出现无法下载或内容有问题,请联系客服协助您处理。
× 常见问题(客服时间:周一到周五 9:30-18:00)