typedef struct product{int num; //编号char type[20]; //类型char name[20]; //名称int price; //价格long in_time; //入库时间char inper_name[20]; //经手人char yes_no; //是否在库long out_time; //外借时间char outper_name[20]; //外借人姓名long re_time; //归还时间 struct product *next;}Node;void creat_link(){int i,x,n;printf("添加多少个数据");scanf("%d",&n);Node *p;if((fp=fopen("t.txt","a"))==NULL){printf("error");exit(1);}for(i=0;i<n;i++){p=(Node*)malloc(sizeof(Node));if(p==NULL){printf("no enough memory");exit(1);}printf("编号");scanf("%d",&x);p->num=x;printf("类型");scanf("%s",p->type);printf("名称");scanf("%s",p->name);printf("价格");scanf("%s",&(p->price));printf("入库时间");scanf("%d",&(p->in_time));printf("经手人");scanf("%s",p->inper_name);printf("是否在库");scanf("%c",&(p->yes_no));if(p->yes_no==n){printf("外借时间");scanf("%d",&(p->out_time));printf("外借人");scanf("%s",p->outper_name);printf("归还时间");scanf("%d",&(p->re_time));}else{p->out_time=p->in_time;p->re_time=p->in_time;strcpy(p->outper_name,p->inper_name);}free(p);p=NULL;}system("PAUSE");system("cls");}也就是最后那个是否在库我无法输入
添加回答
举报
0/150
提交
取消