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
提交
取消