五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

錯誤代碼

2023-03-15 09:53 作者:孒衿  | 我要投稿

#include <stdio.h>

#include <stdlib.h>

#define OK 1

#define ERROR 0

#define OVERFLOW -2

typedef int status,Elemtype;

typedef struct LNode{

? ? Elemtype data;//數(shù)據(jù)域

? ? struct LNode *next;//指針域

}LNode,*LinkList;

//函數(shù)聲明

//創(chuàng)建單鏈表

?LinkList CreateList(int n);

?void ShowList;

?LinkList CreateList(int n){

? ? //創(chuàng)建一個空的單鏈表

? LinkList L=(LNode*)malloc(sizeof(LNode));

? L->next=NULL;

//采用后插法進(jìn)行創(chuàng)建

? LNode *r=L;//初始化尾指針

? int i;

? LNode *p;

? for(i=0;i<n;i++){

? ? ? ? //創(chuàng)建新節(jié)點(diǎn)

? ? p=((LNode*)malloc(sizeof(LNode)));

? ? p->next=NULL;

? ? printf("請輸入第%d個數(shù)據(jù)元素:",i);

? ? scanf("%d",&p->data);

? ? //插入到尾結(jié)點(diǎn)后,成為新的尾結(jié)點(diǎn)

? ? r->next=p;

? ? r=p;

}

printf("單鏈表創(chuàng)建完畢!");

return L;

}

? void ShowList(LinkList L){

? ? LNode *p=L->next;

? ? printf("單鏈表為:");

? ? while(p){

? ? ? ? printf("%d ",p->data);

? ? ? ? p=p->next;

? ? }


}

//插入函數(shù)

status ListInsert(LinkList L,int i,Elemtype e){

? ? LNode *p=L;

? ? int j=0;

? ? while(p&&j<j-1){

? ? ? ? p=p->next;

? ? ? ? j++;

? ? }

? ? if(!p||j>i-1){

? ? ? ? printf("插入位置不合法");

? ? ? ? return ERROR;

? ? }

? ? LNode *s=(LNode *)malloc(sizeof(LNode));

? ? s->next=e;

? ? s->next=p->next;

? ? p->next=s;

? ? printf("插入成功,更新后的單鏈表為:");

? ? ShowList(L);

? ? return OK;

}


int main()

{

? ? LinkList L=NULL;

? ? printf("請輸入要創(chuàng)建的單鏈表的長度:");

? ? int n;

? ? scanf("%d",&n);

? ? L=CreateList(n);

? ? ShowList(L);

? ? printf("\n請輸入要插入的位置和值,用空格間隔:");

? ? int i;

? ? Elemtype e;

? ? scanf("%d %d",&i,&e);

? ? ListInsert(L,i,e);

}


錯誤代碼的評論 (共 條)

分享到微博請遵守國家法律
彰武县| 西吉县| 莱阳市| 九龙坡区| 阳曲县| 淳化县| 云南省| 千阳县| 梁山县| 宁化县| 含山县| 厦门市| 海门市| 阳曲县| 永福县| 汕尾市| 沁阳市| 盘锦市| 汉沽区| 油尖旺区| 区。| 孙吴县| 察隅县| 星子县| 肇州县| 金阳县| 滦平县| 通许县| 随州市| 宁晋县| 文登市| 庆元县| 仙游县| 宁城县| 宝清县| 台江县| 阆中市| 西藏| 获嘉县| 满城县| 苏尼特右旗|