回 帖 发 新 帖 刷新版面

主题:十万火急!大家一起来纠错!谁能帮我,我就赞美谁!

[size=6][size=4][b]file1.c
#include<stdio.h>
#define NULL 0
#define LEN sizeof(struct worker)
struct date
{
     int day;
     int month;
     int year;
};
struct worker
{
     char num[8];
     char name[12];
     struct date birthday;
     struct worker * next;
}work;
int n;
void main()
{   struct worker * del(struct worker * head,int nian,int yue,int ri);
    struct worker *(creat)(void);
    struct worker * insert (struct worker * head,struct worker * worker_1);
    struct worker * print(struct worker * head);
    struct worker * head;
    int nian,yue,ri;
    printf("**************************************************\n");
    printf("(1)主函数首先输入职工个数,之后调用creat函数建立链表:\n");
    printf("(2)调用search函数显示指定姓名结点的学生的信息:\n");
    printf("新建一个结点并输入相应的信息,调用ins函数将该结点插入链表使得编号仍然有序;\n");
    printf("输入某截止日期,调用del函数将年龄50周岁以上的职工结点从链表中删除\n");
    printf("最后调用printf函数输出整个链表\n");
    head=creat();
    printf("请输入将要插入的结点所包含的数据,包括编号,姓名,出生年,月,日\n");
    scanf("%s,%s,%d,%d,%d",work.num,work.name,&work.birthday.day,&work.birthday.month,&work.birthday.year);
    head=insert(head,&work);
    printf("输入截止日期\n");
    scanf("%d,%d,%d",&nian,&yue,&ri);
    del(head,nian,yue,ri);
    printf("输出所有列表\n");
    print(head);
}
file2.c
#include<stdio.h>
extern n;
struct worker * del(struct worker * head,int nian,int yue,int ri)
{
    struct worker *p1,*p2;
    p1=head;
    if(year!=(*p1).birthday.year||(2007-(*p1).birthday.year)>50)
    {
        p2=p1;
        p1=p1->next;
    }
    else if(month>=(*p1).birthday.month)
    {
        p2=p1;
        p1=p1->next;
    }
    n=n-1;
    return(head);
}

file3.c
#include<stdio.h>
#include<malloc.h>
#define LEN sizeof(struct worker)
struct worker *(creat)(void)
{
    struct worker * head ;
    struct worker * p1,*p2;
    int i,people;
    printf("请输入职工的人数\n");
    scanf("%d",&people);
    head=p1=p2=(struct worker *)malloc(LEN);
    printf("请输入职工的编号,姓名,生日\n");
    scanf("%s,%s,%d,%d,%d",p1->num,p1->name,&(*p1).birthday.day,&(*p1).birthday.month,&(*p1).birthday.year);
    for(i=1;i<=2;i++)
    {
        p2->next=p1;
        p2=p1;
        p1=(struct worker *)malloc(LEN);
        scanf("%s,%s,%d,%d,%d",p1->num,p1->name,&(*p1).birthday.day,&(*p1).birthday.month,&(*p1).birthday.year);
    }
    p2=NULL;
    return(head);
}
file4.c
#include<stdio.h>
#define NULL 0
#define LEN sizeof(struct worker)
struct date
{
     int day;
     int month;
     int year;
};
struct worker
{
     char num[8];
     char name[12];
     struct date birthday;
     struct worker * next;
}work;
int n;
void main()
{   struct worker * del(struct worker * head,int nian,int yue,int ri);
    struct worker *(creat)(void);
    struct worker * insert (struct worker * head,struct worker * worker_1);
    struct worker * print(struct worker * head);
    struct worker * head;
    int nian,yue,ri;
    printf("**************************************************\n");
    printf("(1)主函数首先输入职工个数,之后调用creat函数建立链表:\n");
    printf("(2)调用search函数显示指定姓名结点的学生的信息:\n");
    printf("新建一个结点并输入相应的信息,调用ins函数将该结点插入链表使得编号仍然有序;\n");
    printf("输入某截止日期,调用del函数将年龄50周岁以上的职工结点从链表中删除\n");
    printf("最后调用printf函数输出整个链表\n");
    head=creat();
    printf("请输入将要插入的结点所包含的数据,包括编号,姓名,出生年,月,日\n");
    scanf("%s,%s,%d,%d,%d",work.num,work.name,&work.birthday.day,&work.birthday.month,&work.birthday.year);
    head=insert(head,&work);
    printf("输入截止日期\n");
    scanf("%d,%d,%d",&nian,&yue,&ri);
    del(head,nian,yue,ri);
    printf("输出所有列表\n");
    print(head);
}
file5.c
#include<stdio.h>
#define NULL 0
struct worker * print(struct worker * head)
{
    struct worker * p;
    printf("员工的基本情况如下所示\n");
    p=head;
    do
    {
        printf("%s,%s,*(p->num),*(p->name),(*p).birthday.day,(*p).birthday.month",(*p).birthday.year);
        p=p->next;
    }while(p!=NULL);
}

    
    







        
    
    



[em1][em1][em1][color=800000][/color][color=808000][/color][em4][em4][em4][em4][email]songkaisongabc@126.com[/email]
[img]http://www.sdust.edu.cn/upload/thumb/1157447613.gif[/img][url=http://www.sdust.edu.cn/]http://www.sdust.edu.cn/[/url][b][/b][/b][/size][/size]

回复列表 (共1个回复)

沙发

can you  tell me what do you want? what does your mean?

我来回复

您尚未登录,请登录后再回复。点此登录或注册