![C語言課設(shè)學(xué)生信息管理系統(tǒng)_第1頁](http://file3.renrendoc.com/fileroot_temp3/2021-12/18/a4c097bf-6d1f-4e86-945d-c5b9b62ff10c/a4c097bf-6d1f-4e86-945d-c5b9b62ff10c1.gif)
![C語言課設(shè)學(xué)生信息管理系統(tǒng)_第2頁](http://file3.renrendoc.com/fileroot_temp3/2021-12/18/a4c097bf-6d1f-4e86-945d-c5b9b62ff10c/a4c097bf-6d1f-4e86-945d-c5b9b62ff10c2.gif)
![C語言課設(shè)學(xué)生信息管理系統(tǒng)_第3頁](http://file3.renrendoc.com/fileroot_temp3/2021-12/18/a4c097bf-6d1f-4e86-945d-c5b9b62ff10c/a4c097bf-6d1f-4e86-945d-c5b9b62ff10c3.gif)
![C語言課設(shè)學(xué)生信息管理系統(tǒng)_第4頁](http://file3.renrendoc.com/fileroot_temp3/2021-12/18/a4c097bf-6d1f-4e86-945d-c5b9b62ff10c/a4c097bf-6d1f-4e86-945d-c5b9b62ff10c4.gif)
![C語言課設(shè)學(xué)生信息管理系統(tǒng)_第5頁](http://file3.renrendoc.com/fileroot_temp3/2021-12/18/a4c097bf-6d1f-4e86-945d-c5b9b62ff10c/a4c097bf-6d1f-4e86-945d-c5b9b62ff10c5.gif)
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、11.2.3.調(diào)調(diào)調(diào)月月用creat 函數(shù)()displ 函數(shù)dele 喊)add( 函15.6.7.8.9.調(diào)調(diào)調(diào)調(diào)調(diào)用用用用用sort() save()loadmodify()search(憚函函函 數(shù)函 數(shù)數(shù)數(shù)數(shù)4.調(diào) 用非法選項(xiàng)結(jié)束全局變量struct studchar name20;long num;int age;char sex;int score3;char tele12;struct stud *next;子程序1.creat()函數(shù)y 繼續(xù),輸入n 停功能:創(chuàng)建鏈表,提示輸入學(xué)生信息,儲(chǔ)存到鏈表中,錄入完成后輸入止,返回主菜單2.display()函數(shù)功能:顯示當(dāng)前已經(jīng)存入
2、鏈表的信息3.dele()函數(shù)功能:刪除鏈表中學(xué)生信息,可按姓名或?qū)W號(hào)刪除4.add()函數(shù)功能:按學(xué)號(hào)插入學(xué)生信息5.modify()函數(shù)功能:修改鏈表中學(xué)生信息6.search()函數(shù)功能:查找學(xué)生信息,可按學(xué)號(hào)或姓名查找7.sort()函數(shù)功能:對(duì)信息進(jìn)行排序,可實(shí)現(xiàn)分別對(duì)三門成績(jī)排序8.save()函數(shù)功能:將鏈表中的數(shù)據(jù)保存到指定文件9.load()函數(shù)功能:將指定文件中已有的數(shù)據(jù)讀入鏈表源程序#include<stdio.h>#include<string.h> #include<stdlib.h> #include<conio.h>
3、 struct studchar name20;long num;int age;char sex;int score3;char tele12;struct stud *next;main()struct stud *head;struct stud *creat(void);void display(struct stud *head);struct stud *dele(struct stud *head);struct stud *add(struct stud *head);struct stud *modify(struct stud *head);void search(stru
4、ct stud *head);void save(struct stud *head);struct stud *sort(struct stud *head);void save(struct stud *head);struct stud *load();char ch;head=NULL;for(;) clrscr(); /* 清屏函數(shù)*/printf( printf(nnttWelcometostudentinformationmanagementnnt*printf(nttt1:Enter the information ”);printf(nttt2:List the inform
5、ation ”);printf(nttt3:Delete the information ”);printf(nttt4:Add the information ”);printf(nttt5:Modify the information ”);printf(nttt6:Search the information ” );printf(nttt7:Sort the information ”);printf(nttt8:Save the information ” );printf(nttt9:Load the information ” );printf(nttt0:Exit “);pri
6、ntf(ntttEnter your choice: ” );system” );”);fflush(stdin);ch=getchar();getchar();switch(ch)case 1 : head=creat();break;case 2:display(head);system(“ pause”);break;case 3:head=dele(head);system(“ pause”);break;case 4:head=add(head);system(“ pause”);break;case 5:head=modify(head);system(“ pause”);brea
7、k;case 6:search(head);system(“ pause”);break;case 7:head=sort(head);system(“ pause”);break;case 8:save(head);system(“ pause”);break;case 9:head=load();break;case 0:return;break;default : clrscr();printf( “nt Error!Please check your inputnn ”); system(“ pause”);struct stud *creat(void) /*鏈表的創(chuàng)建*/struc
8、t stud *head,*p1;char ch;clrscr();head=NULL;p1=(struct stud *)malloc(sizeof(struct stud);printf( “t enter name:”);gets(p1->name); printf( “t enter number: ” );scanf(“ %ld ”,&p1->num);printf( “t enter age:”);scanf(“%d ” ,&p1->age);printf( “t enter sex:”);fflush(stdin);scanf(“ %c” ,&a
9、mp;p1->sex);printf( “t enter Math score: ”);scanf(“ %d ”,&p1->score0);printf( “t enter English score:” );scanf(“%d ” ,&p1->score1);printf( “t enter C score:” );scanf(“%d ” ,&p1->score2);printf( “t enter telephone number:” );fflush(stdin); gets(p1->tele);head=p1;p1->next
10、=NULL;Y or N?”);do printf( “ntDO YOU WANT TO CONTINUE?printf( “ntEnter your choise:”);fflush(stdin); ch=getchar(); clrscr(); if(ch= y |ch=Y )head=add(head);else if(ch!= N &&ch!= n) printf( “ ntError !Please check your input” );ch= y ;while(ch= y |ch= Y ); return(head);struct stud *dele(struc
11、t stud *head)/* struct stud *p1,*p2;int choose;long delnum;char name20;clrscr();printf( “ nttChoose the way you want printf(“ nt 1: According to namenprintf(“ nt 2: According to numnprintf( “ nt Enter your choice: scanf( “ %d” ,&choose);fflush(stdin);if(choose=1)printf( “ nt Enter the name:” );g
12、ets(name); if(head=NULL)printf(鏈表的刪除*/););););tnNo information !n ” );return(head); p1=head;while(strcmp(name,p1->name)!=0&&p1->next!=NULL) p2=p1;p1=p1->next;if(strcmp(name,p1->name)=0)if(p1=head)head=p1->next;else p2->next=p1->next;printf( “ t Delete Successed !nn” );el
13、se printf( “ t Not been find!nn ” );return(head);else if(choose=2)printf( “ ntEnter the number:” );scanf( “ %ld” ,&delnum);if(head=NULL)printf( “nNo information !n” );return(head); p1=head;while(delnum!=p1->num&&p1->next!=NULL)p2=p1;p1=p1->next;if(delnum=p1->num)if(p1=head)he
14、ad=p1->next;else p2->next=p1->next;printf( “ t Delete Successed !nn” );else printf( “ t Not been find!n ” );return(head);else printf(“nt Error!Please check your inputnn ” );return(head);void display(struct stud *head)struct stud *p;p=head;clrscr();if(head=NULL)printf( “ nt No informationnn
15、” );else printf( “ nametnumbertagetsextMathtEnglishtCttelephonenumbern ” );doprintf( “%st%ldt%dt%ct%dt%dt%dt%sn ” ,p->name,p->num,p->age,p->sex,p->score 0,p->score1,p->score2,p->tele);p=p->next;while(p!=NULL); struct stud *add(struct stud *head)/*鏈表的插入*/struct stud *p1,*p2
16、,*p0;p0=(struct stud *)malloc(sizeof(struct stud);clrscr();printf( “ntt Input the information: ” );printf( “ntt name:”);fflush(stdin);gets(p0->name);printf(“ ttnumber:” );scanf(“ %ld”,&p0->num);printf(“ tt ” age:” );scanf(“ %d”,&p0->age);printf(“ ttsex:” );fflush(stdin);scanf(“ %c”,
17、&p0->sex);printf(“ ttMath score:”);scanf(“ %d”,&p0->score0);printf(“ ttEnglish score:” );scanf(“ %d”,&p0->score1);printf(“ ttC score:” );scanf(“ %d”,&p0->score2);printf(“ tttelephone number:”fflush(stdin);gets(p0->tele);p1=head;if(head=NULL)head=p0;p0->next=NULL;els
18、ewhile(p0->num>p1->num)p2=p1,p1=p1->next;if(p0->num<=p1->num)if(head=p1)head=p0;else p2->next=p0;p0->next=p1;elsep1->next=p0;p0->next=NULL;return(head);struct stud *modify(struct stud *head)/*鏈表的修改*/struct stud *p1,*p2,*p0;clrscr();printf( “ ntInput the student s nam
19、e: ” );p0=(struct stud *)malloc(sizeof(struct stud);fflush(stdin);gets(p0->name);if(head=NULL)printf( “nNo information !nn”);return(head); p1=head;while(strcmp(p0->name,p1->name)!=0&&p1->next!=NULL)p2=p1;p1=p1->next;if(strcmp(p0->name,p1->name)=0)printf( “ nametnumbertag
20、etsextMathtEnglishtCttelephone numbern” );printf( “ %st%ldt%dt%ct%dt%dt%dt%sn,p1->name,p1->num,p1->age,p1->sex,p1->score0,p1->score1,p1->score2,p1->tele);if(p1=head)head=p1->next; else p2->next=p1->next; printf( “tNew information: number: ”); scanf(“%ld ”,&p0->
21、;num); printf( “tttage:”); scanf(“%d ”,&p0->age);printf( “ttt sex:”); fflush(stdin); scanf(“%c ”,&p0->sex); printf( “ttt Math score:” ); scanf(“ %d ”,&p1->score0); printf( “ttt English score:”); scanf(“%d ” ,&p1->score1); printf( “ttt C score:” ); scanf(“%d ” ,&p1->
22、;score2); printf( “ttt telephone number: ”); fflush(stdin); gets(p0->tele); p1=head; if(head=NULL)head=p0;p0->next=NULL; elsewhile(p0->num>p1->num)p2=p1;p1=p1->next;if(p0->num<=p1->num)if(head=p1)head=p0;else p2->next=p0;p0->next=p1;elsep1->next=p0;p0->next=NUL
23、L;printf( “ Modify Successed !nn” );else printf( “ Not been find!nn ” );return(head);void search(struct stud *head)/* 查詢鏈表*/struct stud *p;int choose;long num;char name20;clrscr();printf(“ nttChoose the way you want” );printf(“ nt 1: According to namen“ );printf( “ nt 2: According to numn ” );printf
24、( “ nt Enter your choice:” );scanf( “ %d” ,&choose);fflush(stdin);if(choose=1)printf( “ nt enter the name:” );gets(name);if(head=NULL)printf( “tnNo information !nn ” ); elsep=head;while(strcmp(name,p->name)!=0&&p->next!=NULL)p=p->next;if(strcmp(name,p->name)=0)printf( “ namet
25、numbertagetsextMathtEnglishtCttelephone numbern” );printf( “%st%ldt%dt%ct%dt%dt%dt%sn ” ,p->name,p->num,p->age,p->sex,p->score 0,p->score1,p->score2,p->tele);else printf( “ Not been find!nn ” );else if(choose=2)printf( “ nt Enter the number:” );scanf( “ %ld” ,&num);if(hea
26、d=NULL)printf( “ nNo information!n ” ); else p=head;while(num!=p->num&&p->next!=NULL)p=p->next; if(num=p->num) printf( “ nametnumbertagetsextMathtEnglishtCttelephone numbern” );printf( “%st%ldt%dt%ct%dt%dt%dt%sn ” ,p->name,p->num,p->age,p->sex,p->score 0,p->scor
27、e1,p->score2,p->tele);else printf( “ t Not been find!n ” );else printf( “ nt Error!Please check your inputnn” ); struct stud *sort(struct stud *head) struct stud *first;struct stud *t;struct stud *p;struct stud *q;int ch; clrscr(); printf( printf( printf( printf( printf( scanf(nttChoose the wa
28、y you wantntntntnt1: According to Math:n2: According to Englishn3: According to Cn Enter your choice:%d” ,&ch);););” ););” );first = head->next;head->next = NULL;while (first != NULL)for (t=first, q=head; (q!=NULL) && q=q->next);(q->scorech-1>t->scorech-1);p=q,first = f
29、irst->next;if (q = head)head = t;elsep->next = t;t->next = q;printf( “ nttSuccess !n” );return head;void save(struct stud *head) /*保存鏈表*/FILE *fp;struct stud *p;char filename20;printf( “ nninput the filename:“ );fflush(stdin);gets(filename);if(fp=fopen(filename, ” w” )=NULL)printf( “ Save f
30、ile %s error ! Type it again.nnexit(0);p=head;while(p!=NULL) fprintf(fp, ” %st ” ,p->name);fprintf(fp,” %ldt ”,p->num);fprintf(fp,” %dt ”,p->age);fprintf(fp,” %ct ”,p->sex);fprintf(fp,” %dt ”,p->score0)fprintf(fp,” %dt ”,p->score1)fprintf(fp,” %dt ”,p->score2)fprintf(fp,” %stn”
31、,p->tele);p=p->next;printf( “ nttSuccess !n” );fclose(fp);struct stud *load() /*鏈表的導(dǎo)入*/FILE *fp;char filename20;struct stud *head,*p1,*p2;printf( “ nninput the filename:“ );fflush(stdin);gets(filename);if(fp=fopen(filename, ” r ” )=NULL),filename);,filename);printf( “ Load file %s error ! Type it again.nn exit(0); if(!feof(fp)head=(str fscanf(fp, fscanf(fp, fscanf(fp, fscanf(fp, fscanf(fp, fscanf(fp, fscanf(fp, fscanf(fp, p2=
溫馨提示
- 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. 人人文庫網(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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- EPC總承包項(xiàng)目總體實(shí)施方案
- 臨時(shí)用工項(xiàng)目合同范本
- 修理報(bào)廢貨車合同范本
- 2025年家電產(chǎn)品出口代理與分銷合同
- 公對(duì)公購買合同范本
- 供銷合同范例付款方式
- 2025年度家政保潔與家庭環(huán)保改造服務(wù)合同
- 2025年度家政保潔服務(wù)與家居美化保養(yǎng)合同范本
- 別墅庭院采購合同范例
- 決算清單編制費(fèi)合同范本
- 環(huán)境因素匯總識(shí)別及評(píng)價(jià)表(保衛(wèi)部 )
- GB/T 33880-2017熱等靜壓鋁硅合金板材
- 消防安全風(fēng)險(xiǎn)辨識(shí)清單
- 超市店長(zhǎng)考核方案(實(shí)例)
- 2023年版勞動(dòng)實(shí)踐河北科學(xué)技術(shù)出版社一年級(jí)下冊(cè)全冊(cè)教案
- 方案報(bào)審表(樣表)
- 運(yùn)動(dòng)按摩全套課件
- 除銹、油漆檢驗(yàn)批質(zhì)量驗(yàn)收記錄樣表
- pp顧問的常見面試問題
- 法理學(xué)原理與案例完整版教學(xué)課件全套ppt教程
- 軟體家具、沙發(fā)質(zhì)量檢驗(yàn)及工藝
評(píng)論
0/150
提交評(píng)論