第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

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

求問為什么單鏈表頭插進(jìn)去會倒序顯示?

求問為什么單鏈表頭插進(jìn)去會倒序顯示?

C++
qq___611 2018-05-16 13:02:31
#include<iostream>#include<string>#define ERROR 0#define OK 1using namespace std;typedef struct node{ char word[20]; char tran[20]; node *next;}ListNode,*List;void creat(List &L){ L=new ListNode; L->next=NULL;}int real(char s[],List L){ ListNode *p=L->next; while(p!=NULL){ if(s==p->word){ printf("error"); return ERROR; } p=p->next; } return OK;}void display(List L){ ListNode *p=L->next; while(p!=NULL){ cout<<p->word<<' '<<p->tran<<endl; p=p->next; }}void insert(List &L){ char str1[20]={'N'}; ListNode *p=L,*s; int j=1,i=1,k=1; while(j){ s=new ListNode; cin>>s->word>>s->tran; if(strcmp(s->word,str1)==0){ printf("添加完成"); j=0; break; } i=real(s->word,L); if(i==0) printf("error\n"); else{ s->next=p->next; p->next=s; k++; printf("OK\n"); } }}void main(){ ListNode *L; creat(L); insert(L); display(L);}
查看完整描述

目前暫無任何回答

  • 0 回答
  • 0 關(guān)注
  • 949 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號