本人菜鸟,求大神帮忙看看什么问题了
#include"stdio.h"#include"math.h"
#include"string.h"
#include"stdlib.h"
#include"time.h"
#include<malloc.h>
#define ERROR 0
#define OK 1
typedef struct article{char name[20];
char purpose[50];
char last[20];/* 最后限期*/
char mainkind[20];
int num;
struct article *next;
}article,*L;
void new_article(L &w)
{int i=0;
L a,e;
e=(L)malloc(sizeof(article));
e=w;while(e)
e=e->next;
a=(L)malloc(sizeof(article));
a->next=NULL;
printf("请输入编号:");
scanf("%d",&(a->num));
printf("\n");
printf("请输入物品名称:");
scanf("%s",&a->name);
printf("\n");
printf("请输入最后限期:");
scanf("%s",&a->last);
printf("\n");
printf("请输入种类:");
scanf("%s",&(a->mainkind));
printf("\n");
e->next=a;
}
void load(L w)
{L a;
a=w->next;
while(a)
{printf("编号:");
printf("%d\n",a->num);
printf("名称:");
printf("%s",a->name);
printf("\n");
printf("最后限期:");
printf("%s",a->last);
printf("\n");
printf("种类:");
printf("%s",a->mainkind);
printf("\n");
a=a->next;
}
}
int main()
{L w,a;
w=(L)malloc(sizeof(article));
w->next=NULL;
new_article(w);a=(L)malloc(sizeof(article));
a=w;
load(w);
return OK;
}
坐等回复