資源描述:
《學(xué)生信息處理系統(tǒng)雛形(鏈表).doc》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在工程資料-天天文庫(kù)。
1、//學(xué)生信息處理系統(tǒng)完善版能完成數(shù)據(jù)的輸入,輸出,插入,刪除排序,修改等功能(鏈表實(shí)現(xiàn))2012.7.18#include#include#include#includeintp_zfc(charzfc_no[],int*shuzi_P);//判斷是否為數(shù)值型字符,如不是返0,否則轉(zhuǎn)換為十進(jìn)制,并返回1;voidchuli_p_zfc(charcansu[],int*p_shuzi);//判斷字符串函數(shù)返回值處理函數(shù)structstudent*creat_list
2、(void);//創(chuàng)建鏈表voidtraverse_list(structstudent*phead);//遍歷鏈表intis_temp(structstudent*phead);//判斷鏈表是否為空intlong_list(structstudent*phead);//判斷鏈表的長(zhǎng)度voidno_sort_list(structstudent*phead,intlen);//鏈表根據(jù)學(xué)號(hào)排序voidchengji_sort_list(structstudent*phead,intlen);//鏈表根據(jù)學(xué)號(hào)排序voidinsert_list
3、(structstudent*phead,intinsert_location);//插入鏈表函數(shù)voiddelete_list(structstudent*phead,intdelete_location);//刪除鏈表函數(shù)voidchange_list(structstudent*phead,intchang_location);//修改鏈表內(nèi)容//定義結(jié)構(gòu)體structstudent{intno;charname[20];///數(shù)據(jù)域intchengji;structstudent*pnext;};//主函數(shù)intmain(void)
4、{charxuan;//主菜單選項(xiàng)變量intjishuqi=0;//主菜單中a選項(xiàng)執(zhí)行次數(shù)的統(tǒng)計(jì)變量intkong;//鏈表是否為空變量intshuzi;//輸入的是字符串,返回的是正整數(shù)char_len[20];//鏈表長(zhǎng)度(為字符串是未確定值)變量intlen;//鏈表長(zhǎng)度(為正整數(shù)是確定值)變量char_insert_location[20];//插入鏈表節(jié)點(diǎn)位置(為字符串是未確定值)變量intinsert_location;//插入鏈表節(jié)點(diǎn)位置(為正整數(shù)是確定值)變量char_delete_location[20];//刪除鏈表節(jié)點(diǎn)
5、位置(為字符串是未確定值)變量intdelete_location;//刪除鏈表節(jié)點(diǎn)位置(為正整數(shù)是確定值)變量char_change_location[20];//修改鏈表節(jié)點(diǎn)位置(為字符串是未確定值)變量intchange_location;//修改鏈表節(jié)點(diǎn)位置(為正整數(shù)是確定值)變量structstudent*phead;//頭指針變量printf("歡迎使用本鏈表操作系統(tǒng)!");while(1){while(1){printf("a:建立鏈表");printf("b:顯示鏈表長(zhǎng)度");printf(c:插入");pr
6、intf("d:刪除");printf("e:修改");printf(("f:顯示");printf(("g:按成績(jī)排序");printf(("h:按學(xué)號(hào)排序");printf(("i:繼續(xù)");printf(("j:退出");printf("請(qǐng)選擇選項(xiàng):");scanf("%c",&xuan);fflush(stdin);if(xuan!='a'&&xuan!='b'&&xuan!='c'&&xuan!='d'&&xuan!='e'&&xuan!='f'&&xuan!='g'&&xuan!='h'&&xuan!
7、='i'&&xuan!='j'){printf("輸入錯(cuò)誤,請(qǐng)重選!");continue;}elsebreak;}switch(xuan){case'a':if(jishuqi<1){printf("請(qǐng)創(chuàng)建鏈表!");printf("請(qǐng)輸入你想建立的鏈表結(jié)點(diǎn)個(gè)數(shù):");chuli_p_zfc(_len,&shuzi);len=shuzi;phead=creat_list(len);printf("你創(chuàng)建的鏈表如下:");traverse_list(phead);jishuqi++;break;}else{printf("不
8、能再操作此項(xiàng)!");break;}case'b':printf("顯示鏈表長(zhǎng)度!");len=long_list(phead);printf("現(xiàn)在鏈表的長(zhǎng)度為:%d