C語言習題 鍊錶建立,插入,刪除,輸出

2021-08-21 00:14:47 字數 1580 閱讀 4368

web board

problemset

standing

status

statistics

time limit: 1 sec  

memory limit: 128 mb

submit: 1389  

solved: 687

[submit][

status][

web board]

編寫乙個函式creatlink,用來建立乙個動態鍊錶。(包含學號和成績)

編寫乙個函式printlink,用來輸出乙個鍊錶。

編寫乙個函式dellink,用來刪除動態鍊錶中乙個指定的結點(由實參指定某一學號,表示要刪除該學生結點)。

編寫乙個函式insertlink,用來向動態鍊錶插入乙個結點。

編寫乙個函式freelink,用來釋放乙個動態鍊錶。

輸入多個學生的學號和成績,建立動態鍊錶,以0 0 結束

輸入學號,刪除鍊錶中的對應結點

插入兩個鍊錶結點

輸出的鍊錶

1001 100

1002 95

1005 90

1008 76

0 01005

1006 98

1009 99

1001 100.00

1002 95.00

1006 98.00

1008 76.00

1009 99.00

主函式已給定如下,提交時不需要包含下述主函式

/* c** */

int main()

/* c++** */

int main()

student;

using namespace std ;

student *creatlink()

last = p ;

scanf("%ld%lf",&n,&s);

}return head ; }

student *dellink(student *head,long d)

while( d!=p->num && p->next!=null)

if(d==p->num)

else

pe->next =p->next ;

free(p);

}else

return head;

}student *insertlink(student *head,student *s)

p =head;

if(s->num < head->num)

else if(s->num num &&s->num >head->num )

newbase->next = p ;

pc->next =newbase ;

} else

pl->next =newbase ;

newbase->next =null ;

}return head ; }

void printlink(student *head) }

void freelink(student *head)

}int main()

c 鍊錶的基本操作建立,插入,刪除,輸出。

include include include define n sizeof struct node using namespace std struct node void jianli node head,int n 建立鍊錶 p2 next null void charu node head...

C語言鍊錶的插入和刪除 建立

choicetxt.h 執行要重複的 選擇執行的醒目並將結果付給choice include stdio.h int choicetxt int choice else creat.c include stdio.h include stdlib.h include define.h extern ...

C語言 鍊錶的建立,插入,刪除,列印

include include include 結構體定義 struct node typedef struct node listnode 函式宣告部分 listnode createlist int n void insertlist listnode h,int i,char name,int...