freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

數(shù)據(jù)結(jié)構(gòu)單鏈表課程設(shè)計(jì)設(shè)計(jì)報(bào)告(已改無錯(cuò)字)

2023-05-12 22:48:12 本頁面
  

【正文】 前面*/ Lnext=p。 }}//單鏈表的輸出 void printList(Lnode *head){ printf(輸出的結(jié)果如下: \n)。 Lnode *p = headnext。//頭結(jié)點(diǎn)賦給P if (p == NULL) { printf(List is empty!\n)。 return。 } while (p != NULL) { printf(%d , pdata)。 p = pnext。 } printf(\n)。}void paixu(Lnode *L) /*排序函數(shù)*/{ Linklist r,q,small。int temp。 for(r=Lnext。rnext!=NULL。r=rnext) {small=r。 for(q=rnext。q。q=qnext) /*找到鏈表中最小元素*/ if(qdatasmalldata) small=q。 if(small!=r) {temp=rdata。 rdata=smalldata。 /*把最小的數(shù)值換到P指針?biāo)傅奈恢脭?shù)值上(原P指針的next指向不變)*/ smalldata=temp。 /*把原先p指針?biāo)肝恢玫臄?shù)值填入被置換出的最小元素位置*/ } } } void PrintList(Lnode *L) /*打印鏈表PrintList函數(shù)*/{ Lnode *p=Lnext。 /*帶頭節(jié)點(diǎn),把指針置于第一個(gè)數(shù)*/ if(p==0) {printf(鏈表為空)。} else printf(鏈表為:)。 {while(p) { printf(%d, pdata)。 p=pnext。 } } printf(\n)。} inter(Lnode *L,int i){ Lnode *k=Lnext。 while(k) {if (kdata==i) return 1。 k=knext。 } return 0。}int ListInsert_L(Lnode *L, int i, int e) /*插入函數(shù)*/ { Lnode *p=Lnext。 Lnode *s。 int j=0。 while (p amp。amp。 ji1) {p=pnext。 ++j。} if (!p || ji1) return 0。 s=(Lnode *)malloc(sizeof(Lnode))。 sdata=e。 snext=pnext。 pnext=s。 return 1。}int ListDelete_L(Lnode *L,int i) /*刪除函數(shù)*/{ Lnode *p=Lnext。 int j=0。 Lnode *q。 while (pnext amp。amp。 ji1) {p=pnext。 ++j。} /*找出第i節(jié)點(diǎn),并令p指向其前趨*/ if (!pnext || ji1) return 0。 q=pnext。 pnext=qnext。 free(q)。 return 1。}main(){ int sign,sign1,signa,signb,signc,i,x,ca,cb,cc。 int choice=1。 Lnode *A,*B,*C,*D,*E,*L,*p,*q,*n,*m。 A=(Lnode *)malloc(sizeof(Lnode))。/*開辟地址空間*/ B=(Lnode *)malloc(sizeof(Lnode))。 C=(Lnode *)malloc(sizeof(Lnode))。 D=(Lnode *)malloc(sizeof(Lnode))。 E=(Lnode *)malloc(sizeof(Lnode))。 printf(\t 《數(shù)據(jù)結(jié)構(gòu)課程設(shè)計(jì)單鏈表的基本操作》\n\n)。 while (choice) { printf(\t 請(qǐng)選擇您想進(jìn)行的操作:\n 1:對(duì)A鏈表操作 \n 2:對(duì)B鏈表操作 \n 3:兩鏈表運(yùn)算 \n 4:退出程序 \n \n 您的選擇是:)。 scanf(%d,amp。sign1)。 /*輸入選項(xiàng)*/ if (sign1==1) /*如果選擇1則輸出下列選項(xiàng)界面*/ {L=A。 /*選擇1對(duì)鏈表A進(jìn)行操作*/ ca=1。 while (ca) { printf(\t 請(qǐng)選擇對(duì)A鏈表進(jìn)行的操作:\n 1:建立鏈表 \n 2:對(duì)鏈表排序 \n 3:在鏈表中插入元素 \n 4:在鏈表中刪除元素 \n 5:返回上一級(jí)菜單 \n 您的選擇是:)。 scanf(%d,amp。signa)。 /*輸入對(duì)鏈表A的操作選項(xiàng)*/ switch(signa) { case 1: printf(\n請(qǐng)輸入鏈表元素(輸入去0結(jié)束)\n)。 CreatList(A)。 /*調(diào)用CreatList函數(shù)*/ PrintList(A)。 /*調(diào)用PrintList函數(shù)*/ break。 case 2: printf(對(duì)A鏈表進(jìn)行排序,結(jié)果為:\n )。 paixu(A)。 /*調(diào)用排序函數(shù)*/ PrintList(A)。 /*調(diào)用PrintList函數(shù)*/ break。 case 3: printf(請(qǐng)輸入想要插入的位置及插入的數(shù)值(以逗號(hào)分隔): )。 scanf(%d,%d,amp。i,amp。x)。 if (ListInsert_L(L,i,x)==1) {printf(修改成功!目前A鏈表為:\n)。 PrintList(L)。} else printf(警告!您輸入的插入位置超過鏈表長(zhǎng)度。 \n)。 break。 case 4: printf(請(qǐng)輸入想要?jiǎng)h除的元素位置: )。 scanf(%d,amp。i)。 if (ListDelete_L(L,i)==1) {printf(刪除元素成功!目前A鏈表為:\n)。 PrintList(L)。} else printf(警告!您輸入的刪除位置超過鏈表長(zhǎng)度。 \n)。 break。 case 5: ca=0。 break。 default: printf(警告!只能選擇15。 \n)。 break。 } } } else if (sign1==2) {L=B。 cb=1。 while (cb) {printf(\t 請(qǐng)選擇對(duì)B鏈表進(jìn)行的操作:\n 1:建立鏈表 \n 2:對(duì)鏈表排序 \n 3:在鏈表中插入元素 \n 4:在鏈表中刪除元素 \n 5:返回上一級(jí)菜單 \n 您的選擇是:)。 scanf(%d,amp。signb)。 switch(signb) { case 1: printf(\n請(qǐng)輸入鏈表元素(輸入0
點(diǎn)擊復(fù)制文檔內(nèi)容
試題試卷相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖片鄂ICP備17016276號(hào)-1