vc學(xué)生信息管理系統(tǒng)_第1頁(yè)
vc學(xué)生信息管理系統(tǒng)_第2頁(yè)
vc學(xué)生信息管理系統(tǒng)_第3頁(yè)
vc學(xué)生信息管理系統(tǒng)_第4頁(yè)
vc學(xué)生信息管理系統(tǒng)_第5頁(yè)
已閱讀5頁(yè),還剩19頁(yè)未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡(jiǎn)介

1、vc學(xué)生信息管理系統(tǒng)懸賞分:0 -解決時(shí)間:2008-6-11 16:461) 能夠從屏幕上讀取一個(gè)學(xué)生的信息并將信息存入到數(shù)據(jù)文件中。2) 能夠?qū)⒅付ǖ男畔奈募袆h除。3) 能夠按編號(hào)、姓名對(duì)學(xué)生的信息進(jìn)行檢索并將檢索結(jié)果顯示在屏幕上。4) 可以統(tǒng)計(jì)全部學(xué)生的總成績(jī),及其在班上的排名。5) 能夠統(tǒng)計(jì)各科的平均成績(jī)及及格率。6) 要求有錯(cuò)誤提示功能,例如性別只能輸入男女,輸入錯(cuò)誤提示重新輸入。7) 如果檢索不到相應(yīng)的信息應(yīng)提示用戶。#i nclude <iostream.h>#i nclude <ioma nip.h>#in clude <fstream>

2、#in clude <vector>#i nclude <malloc.h>#i nclude <stdlib.h>#in clude <stri ng>#in clude <process.h>#i nclude <stdio.h>#defi ne NULL 0int const Q=20;#defi ne LEN sizeof(struct stude nt)using n amespace std;int n=0; /定義一個(gè)全局變量統(tǒng)計(jì)學(xué)生人數(shù)/>定義一個(gè)學(xué)生考試信息的結(jié)構(gòu)體struct stude ntch

3、ar nameQ; /用來(lái)存放姓名的char sexQ; /用來(lái)存放性別的long int id; /用來(lái)存放準(zhǔn)考證號(hào)的int score4; /用來(lái)存放分?jǐn)?shù)的int total; /用來(lái)存放總分?jǐn)?shù)的struct stude nt *n ext;/student向量容器vector <stude nt> stu;/>學(xué)生類class In formatio npublic:Information() ; / 構(gòu)造函數(shù).Information() ; / 析構(gòu)函數(shù).student *creat();建立鏈表函數(shù)。void output(stude nt *head);int c

4、ount(student *head); 定義函數(shù) count()統(tǒng)計(jì)考生總數(shù)student *insert(student*head);指針函數(shù) *insert()用來(lái)添加考生信息.student *cancel(student *head,long int num);/指針函數(shù) *cancel()用來(lái)刪除考生信息student *find(student *head,long int num); / 指針函數(shù) *find()用來(lái)查找考生信息. void inorder(student *head); 定義inorder()函數(shù)將考生的總分從大到小排列并輸岀 void average( st

5、ude nt *head); 求學(xué)生成績(jī)的平均分的函數(shù)void save(student *head); 保存函數(shù)student *Read(); 讀取函數(shù)private:stude nt *p1,*p2,*p3,*head,st;In formatio n:l nformatio n()Coutvv" *coutvv"vv歡迎您使用學(xué)生成績(jī)管理系統(tǒng)>>n"coutvv" *nn";In formatio n:l nformatio n()coutvv" *n";Coutvv"vv謝謝您使用學(xué)生成績(jī)管理

6、系統(tǒng)>>n"coutvv" *n";stude nt *l nformatio n:creat(void)/定義一個(gè)指向struct student的結(jié)構(gòu)體指針函數(shù)*creat()用來(lái)增加考生信息.char chQ;n=0; /用來(lái)存放姓名的"vven dl;p1=p2=(student *)malloc(LEN); 調(diào)用malloc()函數(shù)用來(lái)開(kāi)辟一個(gè)新的存儲(chǔ)單元 coutvv"vv請(qǐng)建立學(xué)生考試信息表,在姓名處鍵以!結(jié)束輸入。>>-coutvv"姓名:"cin> >ch;head=NU

7、LL; /給指針head賦初值while (strcmp(ch,"!")!=O)/調(diào)用字符比較函數(shù)strcmp()用來(lái)判斷是否繼續(xù)輸入char str10;int flag=0;p仁(student *)malloc(LEN);/調(diào)用malloc()函數(shù)用來(lái)開(kāi)辟一個(gè)新的存儲(chǔ)單元strcpy(p1->name,ch); /將循環(huán)結(jié)構(gòu)前面輸入的姓名復(fù)制到結(jié)構(gòu)體名為pl的數(shù)組name中coutvv "性別:"cin> >p1->sex;coutvv"準(zhǔn)考證號(hào)(8位):"docin> >str;if(ato

8、l(str)>99999999 | atol(str)vl) coutvv"對(duì)不起,請(qǐng)正確輸入!n"elsep1->id=atol(str); flag=1;while(flag=O);flag=0;COUtvv"計(jì)算機(jī)組成原理成績(jī):";docin> >str;if(atoi(str)>100 | atoi(str)<1)cout«"對(duì)不起,請(qǐng)輸入1-100之間的數(shù)字!n"elsep1->score0=atoi(str); flag=1;while(flag=0);flag=0;CO

9、Utvv"概率統(tǒng)計(jì)成績(jī):"docin> >str;if(atoi(str)>100 | atoi(str)<1)coutvv"對(duì)不起,請(qǐng)輸入1-100之間的數(shù)字!n"else p1->score1=atoi(str); flag=1;while(flag=0);flag=0;coutvv"英語(yǔ)成績(jī):"docin> >str;if(atoi(str)>100 | atoi(str)<1)coutvv"對(duì)不起,請(qǐng)輸入1-100之間的數(shù)字!n"else p1->

10、score2=atoi(str); flag=1;while(flag=0);flag=0;coutvv" C+ 成績(jī):"docin> >str;if(atoi(str)>100 | atoi(str)<1)cout«"對(duì)不起,請(qǐng)輸入1-100之間的數(shù)字!n"else p1->score3=atoi(str); flag=1;while(flag=O);flag=0;p1->total=p1->score0+p1->score1+p1->score2+p1->score3;計(jì)算總分if

11、(n=0)head=p1;如果是輸入第一組學(xué)生考試信息就將指針p1賦給指針headelse p2->next=p1;否則將p1賦給p2所指結(jié)構(gòu)體的next指針 p2=p1;將指針p1賦給指針p2n+; /將n的值加1cout«"姓名:"cin>>ch;將輸入的姓名存放到字符數(shù)組ch中p2->next=NULL;將p2所指結(jié)構(gòu)體的next指針重新賦空值return (head);/將輸入的第一組學(xué)生考試信息返回/>定義output()函數(shù)將考生的信息從頭指針?biāo)竷?nèi)容開(kāi)始輸岀void In formati on :output(stude

12、 nt *head)if(head=NULL) cout<<" 這是一個(gè)空表,請(qǐng)先輸入考生成績(jī).n"elsecout«"n"cout«" *學(xué)生考試成績(jī)信息表*n"平均分cout«"n"cout<<"準(zhǔn)考證號(hào) 姓名性別計(jì)算機(jī)組成原理概率統(tǒng)計(jì)英語(yǔ) C+總分n"cout«"n"p仁head;/將頭指針賦給pdocout<<setw(8)vvp1->id<<setw(9)vvp1- >

13、;n ame<<setw(8)<<p1->sex<<setw(13)<<p1->score0<<setw(16)vvp1->score1<<setw(10)vvp1->score2<<setw(9)<<p1->score3<<setw(6)vvp1->total/4.0vvsetw(11)vvp1->totalv<e ndl;cout«"n"p1=p1->next;/將下一組考生信息的next指針賦給pw

14、hile(p1!=NULL);若指針p非空則繼續(xù),目的是把所有的考生信息都傳給指針p然后輸岀./>統(tǒng)計(jì)學(xué)生人數(shù)的函數(shù)int Information:count(struct student *head)/定義函數(shù) count()統(tǒng)計(jì)考生總數(shù)if(head=NULL)return(O);/若指針head為空返回值為0else return(1+cou nt(head-> next);/函數(shù)的遞歸調(diào)用/>插入學(xué)生的成績(jī)的函數(shù)stude nt *ln formati on:i nsert( stude nt *head)插入新結(jié)點(diǎn)定義一個(gè)指向struct student的結(jié)構(gòu)體指針

15、函數(shù)*insert()用來(lái)添加考生信息.char str10;int flag=0;cout<<"t<<請(qǐng)輸入新增學(xué)生成績(jī)信息 >>n"<<endl;p仁(student *)malloc(LEN); / 使p1指向插入的新結(jié)點(diǎn)coutvv"姓名:"cin>>p1->name;/將輸入的姓名存放到結(jié)構(gòu)體名為p1的數(shù)組name中cout« "性別:"cin> >p1->sex;cout«"準(zhǔn)考證號(hào)(8位):"doc

16、in> >str;if(atol(str)>99999999 | atol(str)<1)cout«"對(duì)不起,請(qǐng)請(qǐng)正確輸入!n"elsep1->id=atol(str); flag=1; while(flag=0);flag=0;coutvv"計(jì)算機(jī)組成原理成績(jī):"docin> >str;if(atoi(str)>100 | atoi(str)<1)coutvv"對(duì)不起,請(qǐng)輸入1-100之間的數(shù)字!n"else p1->score0=atoi(str); flag=

17、1;while(flag=O);flag=O;COUtvv"概率統(tǒng)計(jì)成績(jī):";docin> >str;if(atoi(str)>100 | atoi(str)<1)cout«"對(duì)不起,請(qǐng)輸入1-100之間的數(shù)字!n"else p1->score1=atoi(str); flag=1;while(flag=0);flag=0;cout«"英語(yǔ)成績(jī):"docin> >str;if(atoi(str)>100 | atoi(str)<1)cout«"

18、;對(duì)不起,請(qǐng)輸入1-100之間的數(shù)字!n"else p1->score2=atoi(str); flag=1;while(flag=0);flag=0;cout«" C+ 成績(jī):"docin> >str;if(atoi(str)>100 | atoi(str)<1)cout«"對(duì)不起,請(qǐng)輸入1-100之間的數(shù)字!n"else p1->score3=atoi(str); flag=1;while(flag=0);flag=0;計(jì)算總分p1->total=p1->score0+p1

19、->score1+p1->score2+p1->score3;p2=head;將頭指針賦給p2if(head=NULL) /若沒(méi)調(diào)用次函數(shù)以前的頭指針head為空head=p1;p1-> next=NULL;/則將pl賦給頭指針head并將pl所指結(jié)構(gòu)體成員指針next賦空值elsewhile(p1->id>p2->id)&&(p2-> next!=NULL)p3=p2;/p3指向原p2指向的結(jié)點(diǎn)p2=p2->n ext;/p2后移一個(gè)結(jié)點(diǎn)if(p1->id<=p2->id)if(head=p2)p1- &

20、gt;n ext=head;head=p1; /插入到第一個(gè)結(jié)點(diǎn)之前elsep3->n ext=p1;p1- >n ext=p2; /插入到p3所指結(jié)點(diǎn)之后elsep2->n ext=p1;p1-> next=NULL; /插入到尾結(jié)點(diǎn)之后n+;將學(xué)生人數(shù)加1cout<<"t你輸入的學(xué)生信息已經(jīng)成功插入 "<<endl;return (head);/>刪除函數(shù)student *lnformation:cancel(student *head,long int num)/定義一個(gè)指向 struct student 的結(jié)構(gòu)體

21、指針函數(shù)*delete()用來(lái)刪除考生信息.if(head=NULL)/若調(diào)用次函數(shù)以前的頭指針head為空return(head);elsep仁head;/否則將頭指針賦給p1while(num匸p1->id&&p1->next匸NULL)/尋找要?jiǎng)h除的結(jié)點(diǎn)當(dāng)pl所指的學(xué)生準(zhǔn)考證號(hào)不是輸入的學(xué)生準(zhǔn)考證號(hào)并且pl所指的next指針不為空p2=p1;p1=p1- >n ext;/p2指向原p1指向的結(jié)點(diǎn)p1后移一個(gè)結(jié)點(diǎn)if(num=p1->id)/如果輸入的學(xué)生準(zhǔn)考證號(hào)是p1所指的學(xué)生準(zhǔn)考證號(hào)/結(jié)點(diǎn)找到后刪除if(p1=head) head=p1->

22、next;/ 如果head指針和p1指針相等則將下一個(gè)結(jié)點(diǎn)賦給指針headelsep2->next=p1->next;/否則將p1所指結(jié)點(diǎn)賦給p2所指結(jié)點(diǎn)將要?jiǎng)h除的學(xué)生信息跳過(guò)去coutvv"刪除準(zhǔn)考證號(hào)為"<<numvv"的學(xué)生n"n-;/將學(xué)生人數(shù)減1return(head);/將頭指針?lè)祷?>查找函數(shù)student *Information:find(student *head,long int num)定義一個(gè)指向struct student的結(jié)構(gòu)體指針函數(shù)*find()用來(lái)查找考生信息.if(head=NULL)/

23、若調(diào)用次函數(shù)以前的頭指針head為空coutvv"這是一個(gè)空表,請(qǐng)先輸入考生成績(jī).n"return(head);elsep仁head;/否則將頭指針賦給plwhile (n um!=p1->id&&p1-> next!=NULL)尋找結(jié)點(diǎn)當(dāng)pl所指的學(xué)生準(zhǔn)考證號(hào)不是輸入的學(xué)生準(zhǔn)考證號(hào)并且pl所指的next指針不為空p1=p1- >n ext;/p2指向原pl指向的結(jié)點(diǎn)pl后移一個(gè)結(jié)點(diǎn)if(num=p1->id)/如果要查找的學(xué)生準(zhǔn)考證號(hào)是pl所指的學(xué)生準(zhǔn)考證號(hào)coutvv"n"coutvv"準(zhǔn)考證號(hào)姓名性

24、別計(jì)算機(jī)組成原理 概率統(tǒng)計(jì)英語(yǔ)C+平均分總分n"coutvv"n"coutvvsetw(8)vvp1->idvvsetw(9)vvp1- >n amevvsetw(8)vvp1_>sexvvsetw(13)vvp1->score0<<setw(16)vvp1->score1<<setw(10)vvp1->score2<<setw(9)vvp1->score3<<setw(6)vvp1->total/4.0vvsetw(11)vvp1->totalv<e nd

25、l;cout«"n"elsecoutvv"沒(méi)找到準(zhǔn)考證號(hào)為"<<numvv"的學(xué)生.n" /結(jié)點(diǎn)沒(méi)找到return(head);/定義inorder()函數(shù)將考生的總分從大到小排列并輸岀void In formati on:i no rder(stude nt *head)int i,k,m=0,j;student *pQ;定義一個(gè)指向struct student的結(jié)構(gòu)體指針數(shù)組 pif(head匸NULL)/如果頭指針是空則繼續(xù) m=cou nt(head);cout«"n"cou

26、tvv"學(xué)生考試成績(jī)統(tǒng)計(jì)表n"cout«"n"coutvv"準(zhǔn)考證號(hào)姓名性別計(jì)算機(jī)組成原理概率統(tǒng)計(jì)英語(yǔ)C+平均分總分名次n"coutvv"n"p1=head;for(k=0;kvm;k+)pk=p1;p1=p1- >n ext;for(k=0;kvm-1;k+) / 選擇排序法for(j=k+1;jvm;j+)if(pk->totalvpj->total)P2=pk;pk=pj;pj=p2; /從大到小排列的指針for(i=0;ivm;i+)coutvvsetw(8)vvp1->i

27、dvvsetw(9)vvp1- >n amevvsetw(8)vvp1_>sexvvsetw(13)vvp1->score0<<setw(16)vvp1->score1<<setw(10)vvp1->score2<<setw(9)vvp1->score3<<setw(6)vvp1->total/4.0vvsetw(11)vvp1->totalv<e ndl;cout«"n"/>求各科平均分成績(jī)的函數(shù)void In formatio n:average(stu

28、de nt *head)int k,m;float arg1=0,arg2=0,arg3=0,arg4=0;if(head=NULL)如果頭指針是空則繼續(xù)coutvv"這是一個(gè)空表,請(qǐng)先輸入考生成績(jī).n"elsem=cou nt(head);p1=head;for(k=0;k<m;k+)arg1+=p1->score0;arg2+=p1->score1;arg3+=p1->score2;arg4+=p1->score3;p1=p1- >n ext;arg1/=m;arg2/=m;arg3/=m;arg4/=m;coutvv"全班

29、單科成績(jī)平均分n"cout«"n"coutvv"計(jì)算機(jī)組成原理平均分:"v<setw(7)v<arg1<<"概率統(tǒng)計(jì)平均分:"v<setw(7)v<arg2<<"英語(yǔ)平均分:"<<setw(7)vvarg3<<"C+ 平均分:"<vsetw(7)v<arg4vvendl;coutvv"n"/>保存函數(shù).void In formati on:save(stude nt

30、*head)ofstream out("data.txt",ios:out);out«cou nt(head)<<e ndl;while(head!=NULL) out«head->n ame<<"t"vvhead->id<v"t"vv"t"<<head->sexvv"t"<<head->scoreOvv"t"<<head->score1vv"t&qu

31、ot;<<head->score2vv"t"<<head->score3vv"t"<<head->total<<e ndl;head=head->n ext;/>讀取函數(shù)的實(shí)現(xiàn)stude nt *ln formati on:Read() int i=0;p1= p2=( stude nt *)malloc(LEN);head=NULL;ifstream in(' 'data.txt",ios:out);in> >i;if(i=0)cout&

32、lt;<" data.txt文件中的數(shù)據(jù)為空,請(qǐng)先輸入數(shù)據(jù)。"<<e ndl; return 0;else "<<e ndl;cout«"for(;i>0;i-) p1=(stude nt *)malloc(LEN);ci n> >st. name»st.id»st.sex>>st.score0»st.score1>>st.score2»st.score3>>st.total;strcpy(p1- >n ame,st

33、. name);p1->id=st.id;strcpy(p1->sex,st.sex);p1->score0=st.score0;p1->score1=st.score1;p1->score2=st.score2;p1->score3=st.score3;p1->total=st.total;if(n=0)head=p1;如果是輸入第一組學(xué)生考試信息就將指針p1賦給指針headelse p2->next=p1;否則將p1賦給p2所指結(jié)構(gòu)體的next指針p2=p1;將指針p1賦給指針p2n+; /將n的值加1/顯示讀入數(shù)據(jù)"<<

34、;e ndl;cout«" "<<p1- >n ame«"t" vvp1->id<v"t"vv"t" vvp1_>sex<v"t" vvp1->score0<v"t" vvp1->score1<v"t" vvp1->score2vv"t" vvp1->score3vv"t" <vp1->totalv<e

35、 ndl;cout«"/cout«"數(shù)據(jù)已經(jīng)成功讀取完畢。"<<endl;p2->n ext=NULL;return (head);/> 主函數(shù).int main( void)In formati on pers on;stude nt *head=NULL;char str10;int flag=O;int choice;long int i;head=pers on .Read();docout<< 1 n "<<endl;coutvv" |Cout«"

36、 |學(xué)生成績(jī)管理系統(tǒng)主菜單界面| "vvendl ;讀取數(shù)據(jù)請(qǐng)輸入數(shù)字零| "vvendl;cout<< LT "<<endl;cout«" |.輸入學(xué)生成績(jī)| "vvendl;coutvv" |.顯示學(xué)生成績(jī)| "vvendl;coutvv" |.排序統(tǒng)計(jì)成績(jī)| "vvendl;coutvv" |.查找學(xué)生成績(jī)| "vvendl;coutvv" |.增加學(xué)生成績(jī)| "vvendl;coutvv" |.刪除學(xué)生成績(jī)| &q

37、uot;vvendl;coutvv" |.保存退岀系統(tǒng)| "vvendl;coutvv" L"<<endl;cout«"請(qǐng)輸入您的選擇(1-7):( )bb"cin> >str;if(atoi(str)>7 | atoi(str)<1)coutvv"對(duì)不起,請(qǐng)輸入1-7這幾個(gè)數(shù)字!n"elsechoice=atoi(str);switch(choice)case 1:head=pers on .creat();break;case 2:pers on. output(h

38、ead);break;case 3:pers on .i no rder(head);pers on. average(head);cout«"參加考試的學(xué)生人數(shù)為:"vvperson.count(head)<<"人n" break;case 4:coutvv"請(qǐng)輸入要查找的準(zhǔn)考證號(hào)(8位):"docin> >str;if(atol(str)>99999999 | atol(str)<1)coutvv"對(duì)不起,請(qǐng)輸入正確輸入!n"elsei=atol(str); fla

39、g=1; while(flag=O);flag=0;pers on.fin d(head,i);break;case 5:head=pers on .i nsert(head);pers on. output(head);break;case 6:coutvv"請(qǐng)輸入要?jiǎng)h除的準(zhǔn)考證號(hào)(8位):"docin> >str;if(atol(str)>99999999 | atol(str)vl)coutvv"對(duì)不起,請(qǐng)輸入正確輸入!hn"elsei=atol(str); flag=1; while(flag=O);flag=O;head=pe

40、rs on .ca ncel(head,i);pers on. output(head);break;case 7:pers on. save(head);coutvv"文件已保存!可以安全退岀! !"<<endl;break;default :coutvv"對(duì)不起,您的輸入有誤,請(qǐng)重新輸入。n"break;while(choice!=7);return 0;62008-6-2 13:28我來(lái)評(píng)論>>回答者:你不拉稀諾維奇-二級(jí)C3相關(guān)內(nèi)容?求畢業(yè)論文 VC “學(xué)生信息管理系統(tǒng)”2010-5-25?用VC+做學(xué)生信息管理系統(tǒng)”的登

41、錄界面3 2008-3-19?誰(shuí)能幫我vc+做個(gè)學(xué)生信息管理系統(tǒng)5 2008-5-29?用VC編寫(xiě)一個(gè)學(xué)生信息管理系統(tǒng)2008-7-5?誰(shuí)能提供一下用VC+制作一個(gè)學(xué)生信息管理系統(tǒng)的代碼的?。? 2010-7-4更多關(guān)于vc學(xué)生管理系統(tǒng)的問(wèn)題>>查看同主題問(wèn)題:學(xué)生信息管理系統(tǒng)昌等待您來(lái)回答更多«0回答誰(shuí)有易學(xué)C+這本書(shū)的電子版幫忙發(fā)帶 407066663* 0 回答 20 Linux windows socket 傳輸問(wèn)題* 0回答C+簡(jiǎn)單問(wèn)題,謝謝。* 0回答 蘋(píng)果電腦YY語(yǔ)音的聲卡驅(qū)動(dòng)在哪里?QQ757066637* 0回答榮成方正房地產(chǎn)公司開(kāi)發(fā)的寶月山莊怎么樣*

42、0回答c語(yǔ)言中(a)>(b) ? (a):(b)什么意思* 0回答急! !在線等! !* 0回答屢敗屢戰(zhàn)說(shuō)明了什么道理其他回答共1條#i nclude<stdio.h>#in clude<stdlib.h>#in clude<stri ng.h>struct studlong n um;char n ame20;double score;;typedef struct stucodestruct stud stude nt ;struct stucode *n ext;L;void men u();void createlist(struct stuc

43、ode *r);void out(struct stucode *r);void search1(struct stucode *r);void search2(struct stucode *r);void del(struct stucode *r);void in sert(struct stucode *r);void sort(struct stucode *r);void mai n()char choose;int flag=1;struct stucode *r=NULL;while(flag)system("cls");men u();choose=get

44、char();switch(choose)case '1':createlist(&r);out(r);printf("Testing function 1nPress any key to continued"); getchar();getchar();break;case '2':searchl(r);printf("Testing function 1nPress any key to continued"); getchar();getchar();break;case 3:search2(r);prin

45、tf("Testing function 1nPress any key to continued"); getchar();getchar();break;case '4':del(&r);out(r);printf("Testing function 1nPress any key to continued"); getchar();getchar();break;case '5':in sert(&r);out(r);printf("Testing function 1nPress any

46、key to continued"); getchar();getchar();break;case '6':sort (&r);out(r);printf("Testing function 1nPress any key to continued"); getchar();getchar();break;case '7':out(r);pr in tf("Test ing fun cti on 7n Press any key to continued");getchar();getchar();br

47、eak;case 'O':flag=O;pri ntf("The en d.n");break;default: printf("nWrong Selection!(選擇錯(cuò)誤,請(qǐng)重選!)n");getchar();getchar();void createlist(struct stucode *r)struct stucode *p,*t;long n;char a20;double s;if(*r) *r=NULL;n");printf(“ n請(qǐng)輸入:n學(xué)號(hào)(請(qǐng)按學(xué)號(hào)升序排列)姓名分?jǐn)?shù)(若要結(jié)束請(qǐng)輸入三個(gè)為零)sca nf(

48、"%ld%s%lf",&n ,a, &s);if(n=O) retur n;p=(L *)malloc(sizeof(L);p->stude nt. num=n;strcpy(p->stude nt. name,a);p->stude nt.score=s;p-> next=NULL;*r=p;sca nf("%ld%s%lf",&n ,a, &s);while( n)t=p;p=(L *)malloc(sizeof(L);p->stude nt. num=n;strcpy(p->stu

49、de nt. name,a);p->stude nt.score=s;p-> next=NULL;t_>n ext=p;sca nf("%ld%s%lf",&n ,a, &s);void search1(struct stucode *r)long x;if(!r)printf("沒(méi)有學(xué)生信息可查詢!n");return ;printf("請(qǐng)輸入要查詢的學(xué)生信息的學(xué)生學(xué)號(hào):n");sca nf("%ld", &x);while(r&&r->stude

50、nt.n um!=x)r=r- >n ext;if(r=NULL)pri ntf("Error! No such stude nt !n");elsepri ntf("%ld %s %.2lfn",r->stude nt. num,r->stude nt.n ame,r->stude nt.score);void search2(struct stucode *r)char m20;if(!r)printf("沒(méi)有學(xué)生信息可查詢!n");return ;printf("請(qǐng)輸入要查詢的學(xué)生信息的學(xué)生姓名

51、:n");scan f("%s",m);while(r&&strcmp(r->stude nt. name,m)r=r- >n ext;if(r=NULL)pri ntf("Error! No such stude nt !n");elsepri ntf("%ld %s %.2lfn",r->stude nt. num,r->stude nt.n ame,r->stude nt.score);void del(struct stucode *r)long k;struct stucode *p=*r,*t;if(!(*r)prin tf("沒(méi)有學(xué)生信息可刪除!n");return ;printf(“請(qǐng)輸入要?jiǎng)h除的學(xué)生信息的學(xué)生學(xué)號(hào):n");sea nf("%ld",&k);if(p->stude nt. num=k)*r=(*r)->n ext,free(p);elsewhile(p-> next&&

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 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)論