该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
#include
#include
#include
#include
const int n=10;
struct employee
{ char num; //个人编号
char name;
char sex;
char birthday; //生日
char grade; //职称
char degree; //学历
char sumPay; //月薪
char marry; //婚否
struct employee *next;
}em[n];
void add(employee *top); //增加函数
void delete1(employee *top); //删除函数
void edit(employee *top); //修改函数
void display(employee *top); //显示人员信息
void delete1(employee *top) //删除函数
{char choose[2],input1[30];
int cn=0;
cout<
cout<
cout<
gets(choose);
while(1)
{cn=atoi(choose);
if(cn!=1&&cn!=2)
{cout<
gets(choose);
}
switch(cn)
{case 1:
cout<
case 2:
cout<
}
gets(input1);
employee *old,*star;
old=star=top;
while(star!=NULL)
{if((cn==1&&strcmp(input1,star->num)==0)||(cn==2&&strcmp(input1,star->name)==0))
{if(star==top)
top=star->next;
else
old->next=star->next;
cout<
cout<
cout<
cout<num<name<sex<birthday<grade<degree<sumPay<marry;"<
}
void add(employee *top) //增加函数
{
{int x;
employee *m,*q=new employee;
cout<
cin>>top->num>>top->name>>top->sex>>top->birthday>>top->grade>>top->degree>>top->sumPay>>top->marry;
cout<
cin>>x;
for(int i=0;p!=NULL&&i
{m=top;
top++;}
if(top==NULL)
{cout<
m->next=q;q->next=NULL;}
else
{m->next=q;q->next=top;}
}
cout<
}
void save(employee *top) //保存函数
{ofstream out;
out.open("employee.txt",ios::out);
if(!out)
{cout<
exit(1);
}
cout<
employee *p=top;
while(p!=NULL)
{out<
p=p->next;
}
cout<
out.close();
}
void input(employee *top) //输入函数
{ ifsteam in;
in.open("employee.txt",ios::in|ios::nocreate);
if(!in) //判断是否有文件
{cout<
}
else
{in.close();
cout<
employee *old,*star;
old=top;
while(old->next!=NULL)
{old=old->next;}
cout<
cout<
gets(star->num);
if(strcmp(star->num,'0')==0) break;
cout<
gets(star->name);
cout<
gets(star->sex);
cout<
cin>>star->birthday;
cout<
gets(star->grade);
cout<
gets(star->degree);
cout<
gets(star->marry);
if(top->count==0) top=star;
old->next=star;
old=star;
}
while(1)
old->next=NULL;
return(top);
}
void find(employee *top) //查找函数
{char choose[2],input1[30];
int cn=0;