C语言进行员工登记

来源:百度知道 编辑:UC知道 时间:2024/06/08 07:08:40
如何用C语言作一个员工资料登记程序,包括“编号”,“入厂日期”,“姓名”,“性别”,“部门”,“职务”。
二楼能说详细点吗?我刚入门

#include<iostream.h>
#define NULL 0
struct node
{
int date;
struct node *next;
};
node *creat(int n)
{
int i;
node *head,*pf,*pb;
for(i=0;i<n;i++)
{
pb=new node[sizeof (struct node)];
cout<<"输入数据:"<<endl;
cin>>pb->date;
if(i==0)
pf=head=pb;
else
pf->next=pb;
pb->next=NULL;
pf=pb;
}
return head;
}
node *insert(node *head,node *pi)
{
node *pb,*pf;
pb=head;
if(head==NULL)
{
head=pi;
pi->next=NULL;
}
while(pb->date!=pi->date&&pb->next!=NULL)
{
pf=pb;
pb=pb->next;
}
if(pb->date==pi->date&&pb->next!=NULL)
{
pi->next=pb->next;
pb->next=pi;
}
else
pb->next=pi;
pi->next=NULL;
return head;
}
node *deleted(node *he