亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

C語言關于scanf 輸入時遇到這個問題

C語言關于scanf 輸入時遇到這個問題

C
Camel97 2016-02-12 13:58:23
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");}也就是最后那個是否在庫我無法輸入
查看完整描述

2 回答

?
補食者

TA貢獻1條經驗 獲得超0個贊

你好像頭文件少了吧,主函數也沒有???

查看完整回答
反對 回復 2016-02-17
  • 2 回答
  • 0 關注
  • 1952 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號