C語言單鏈表實(shí)現(xiàn)學(xué)生管理系統(tǒng)_第1頁
C語言單鏈表實(shí)現(xiàn)學(xué)生管理系統(tǒng)_第2頁
C語言單鏈表實(shí)現(xiàn)學(xué)生管理系統(tǒng)_第3頁
C語言單鏈表實(shí)現(xiàn)學(xué)生管理系統(tǒng)_第4頁
C語言單鏈表實(shí)現(xiàn)學(xué)生管理系統(tǒng)_第5頁
已閱讀5頁,還剩1頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

第C語言單鏈表實(shí)現(xiàn)學(xué)生管理系統(tǒng)本文實(shí)例為大家分享了C語言單鏈表實(shí)現(xiàn)學(xué)生管理系統(tǒng)的具體代碼,供大家參考,具體內(nèi)容如下

代碼:

#includestdio.h

#includestdlib.h

#includestring.h

#includemalloc.h

structStudent

intnum;//學(xué)號(hào)

charname[20];//名字

charsex[2];

intage;

structStudent*next;

voidinsert(structStudent**head);//插入

voidprint(structStudent*head);//遍歷所有鏈表

voiddele(structStudent**head);//刪除指定內(nèi)容

voidmodify(structStudent**head);//修改內(nèi)容

voidfind(structStudent*head);//查找學(xué)生信息

intmodify_menu();

intmain()

structStudent*head=NULL;

intx;

printf(------------------------------------------\n

printf(學(xué)生管理系統(tǒng)\n

printf(\n

printf(1增加學(xué)生2刪除學(xué)生\n

printf(\n

printf(3修改資料4查找學(xué)生\n

printf(\n

printf(5顯示所有學(xué)生0退出系統(tǒng)\n

printf(\n

printf(------------------------------------------\n

printf(請(qǐng)輸入你需要使用的功能\n

scanf(%d,

switch(x)

case0:break;

case1:

insert(head);

break;

case2:

dele(head);

break;

case3:

modify(head);

break;

case4:

find(head);

break;

case5:

print(head);

break;

default:

printf(選擇錯(cuò)誤?。。n

break;

}while(x);

voidinsert(structStudent**head)

structStudent*p=(structStudent*)malloc(sizeof(structStudent));

structStudent*stu=NULL;

printf(num:

scanf(%d,(p-num));

printf(name:

scanf(%s,(p-name));

printf(sex:

scanf(%s,p-sex);

printf(age:

scanf(%d,p-age);

p-next=NULL;

if(*head==NULL)

*head=p;

else

stu=*head;

while(stu-next!=NULL)

stu=stu-next;

stu-next=p;

voidprint(structStudent*head)

printf(學(xué)號(hào)名字性別年齡\n

while(head!=NULL)

printf(%5d%10s%s%d\n,head-num,head-name,head-sex,head-age);

head=head-next;

voiddele(structStudent**head)

chararr1[20];

structStudent*p1=NULL;//指向要?jiǎng)h除的前一個(gè)結(jié)點(diǎn)

structStudent*p2=*head;//指向要?jiǎng)h除的結(jié)點(diǎn)

printf(請(qǐng)輸入要?jiǎng)h除的學(xué)生\n

scanf(%s,arr1);

while(p2!=NULL)

if(p1==NULLstrcmp(arr1,p2-name)==0)

*head=p2-next;

free(p2);

break;

elseif(strcmp(arr1,p2-name)==0)

p1-next=p2-next;

free(p2);

break;

p1=p2;

p2=p2-next;

print(*head);

voidmodify(structStudent**head)//修改

chararr[20];

intx=0;

structStudent*p=*head;

printf(請(qǐng)輸入需要修改資料的名字\n

scanf(%s,arr);

while(p!=NULL)

if(strcmp(arr,p-name)==0)

printf(請(qǐng)選擇修改的內(nèi)容\n

x=modify_menu();

printf(請(qǐng)輸入新的內(nèi)容\n

switch(x)

case1:

scanf(%d,p-num);

break;

case2:

scanf(%s,p-name);

break;

case3:

scanf(%s,p-sex);

break;

case4:

scanf(%d,p-age);

break;

default:

printf(選擇錯(cuò)誤?。?!\n

break;

print(*head);

break;

p=p-next;

intmodify_menu()//修改的菜單

intchoose=0;

printf(-----------------------------------\n

printf(*1學(xué)號(hào)2姓名*\n

printf(*3性別4年齡*\n

printf(*0取消修改*\n

printf(-----------------------------------\n

scanf(%d,choose);

returnchoose;

voidfind(structStudent*head)

chararr[20];

printf(請(qǐng)輸入學(xué)生姓名\n

scanf(%s,arr);

while(

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論