VC綜合實(shí)驗(yàn)圖書(shū)館管理系統(tǒng)_第1頁(yè)
VC綜合實(shí)驗(yàn)圖書(shū)館管理系統(tǒng)_第2頁(yè)
VC綜合實(shí)驗(yàn)圖書(shū)館管理系統(tǒng)_第3頁(yè)
VC綜合實(shí)驗(yàn)圖書(shū)館管理系統(tǒng)_第4頁(yè)
VC綜合實(shí)驗(yàn)圖書(shū)館管理系統(tǒng)_第5頁(yè)
已閱讀5頁(yè),還剩30頁(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)介

VC++綜合試驗(yàn)圖書(shū)館管理系統(tǒng).txt都是一種山旳狐貍,你跟我講什么聊齋,站在離你近來(lái)旳地方,眺望你對(duì)他人旳微笑,雖然心是百般旳疼痛 只為把你旳一舉一動(dòng)盡收眼底.耀眼旳白色,讓我明白什么是純粹旳傷害。#include<stdio.h>#include<stdlib.h>#include<string.h>#defineLENGTH20#defineSUBJECT10charsubcall[SUBJECT][LENGTH];intnum_of_stu=0;intnum_of_sub=0;structdata{ charname[LENGTH]; charnum[LENGTH]; floatscore[SUBJECT]; floatsum; floataver; structdata*next;};voidMenu(void);structdata*Append(structdata*);voidCheck(structdata*);voidModify(structdata*);voidList(structdata*);voidSearch(structdata*);structdata*Delete(structdata*);structdata*Sort1(structdata*,int(*g)(float,float));voidSort2(structdata*,int(*g)(float,float));intdescend(float,float);intascend(float,float);voidmain(){ Menu();}voidMenu(void){ char*choice[9]={"1.Appendrecord","2.Checkrecord","3.Modifyrecord","4.Listrecord","5.Searchrecord","6.Deleterecord","7.Sortscoreindescendingorder","8.Sortscoreinascendingorder","0.exit"}; structdata*head=NULL; charreply,c; intn=0,k,i; for(i=0;i<9;i++) { k=strlen(choice[i]); n=(n>k)?n:k; } while(1) { system("cls"); printf("\t\tWelcometotheStudents'ScoreManagementSystem\n"); printf("\t\t\t-----------------------------------\n"); for(i=0;i<9;i++) { printf("\t\t\t|%s",choice[i]); k=strlen(choice[i]); for(;n-k>0;k++) putchar(''); printf("|\n"); } printf("\t\t\t-----------------------------------\n"); while(1) { printf("Pleaseinputyourchoice:"); reply=getchar(); if(reply=='\n') continue; else c=getchar(); if(reply>='0'&&reply<='8'&&c=='\n') break; elseif(c!='\n') while(c=getchar()!='\n'); printf("Thereisnosuchchoice!\n"); } if(reply>'1'&&head==NULL) printf("Thereisnodatastored!\n"); else { switch(reply) { case'1':head=Append(head);break; case'2':Check(head);break; case'3':Modify(head);break; case'4':List(head);break; case'5':Search(head);break; case'6':head=Delete(head);break; case'7':Sort2(head,descend);break; case'8':Sort2(head,ascend);break; default:while(1) { printf("Doyoureallywanttoexit(Y/Nory/n)?"); reply=getchar(); if(reply=='\n') continue; else c=getchar(); if((reply=='Y'||reply=='N'||reply=='y'||reply=='n')&&c=='\n') break; elseif(c!='\n') while(c=getchar()!='\n'); } if(reply=='Y'||reply=='y') { free(head); return; } } } while(1) { printf("PressENTERtocontinue:"); scanf("%c",&reply); if(reply=='\n') break; else while(c=getchar()!='\n'); } }}structdata*Append(structdata*head){ structdata*p; charreply,c; inti; system("cls"); if(head==NULL) { p=head=(structdata*)malloc(sizeof(structdata)); printf("Howmanysubjectsdoyouwanttorecord(n<=%d)?",SUBJECT); scanf("%d%*c",&num_of_sub); for(i=0;i<num_of_sub;i++) { printf("Pleaseinputsubject%d'sname:",i+1); scanf("%s%*c",subcall[i]); } } else { for(p=head;p->next!=NULL;p=p->next); p->next=(structdata*)malloc(sizeof(structdata)); p=p->next; }loop:printf("Pleaseinputthestudent'sname:"); scanf("%s%*c",p->name); printf("Pleaseinputthestudent'snumber:"); scanf("%s%*c",p->num); p->sum=0; for(i=0;i<num_of_sub;i++) { printf("Pleaseinputthestudent's%sscore:",subcall[i]); scanf("%f%*c",&p->score[i]); p->sum+=p->score[i]; } p->aver=p->sum/num_of_sub; num_of_stu++; while(1) {printf("Doyouwanttogoonappending(Y/Nory/n)?"); reply=getchar(); if(reply=='\n') continue; else c=getchar(); if((reply=='Y'||reply=='N'||reply=='y'||reply=='n')&&c=='\n') break; elseif(c!='\n') while(c=getchar()!='\n'); } if(reply=='Y'||reply=='y') { p->next=(structdata*)malloc(sizeof(structdata)); p=p->next; gotoloop; } else { p->next=NULL; returnhead; }}voidCheck(structdata*head){ structdata*p,*q; structdata**t=(structdata**)malloc(num_of_stu/2*sizeof(structdata*)); intminlim,maxlim,n=0,i; system("cls"); for(p=head;p!=NULL;p=p->next) { for(i=0;i<n;i++) { if(strcmp(p->name,(*(t+i))->name)==0) break; } if(i<n) continue; for(q=p->next;q!=NULL;q=q->next) { if(strcmp(p->name,q->name)==0) { printf("Name%shasbeeninputedrepeatedly!\n",p->name); *(t+n)=p; n++; break; } } } printf("Altogether%dnamehasbeenrepeatedlyinputed.\n",n); n=0; for(p=head;p!=NULL;p=p->next) { for(i=0;i<n;i++) { if(strcmp(p->num,(*(t+i))->num)==0) break; } if(i<n) continue; for(q=p->next;q!=NULL;q=q->next) { if(strcmp(p->num,q->num)==0) { printf("Student'snumber%shasbeeninputedrepeatedly!\n",p->num); *(t+n)=p; n++; break; } } } printf("Altogether%dnumberhasbeenrepeatedlyinputed.\n",n); free(t); n=0; printf("Nowcheckdata\n"); printf("Pleaseinputtheminimumlimit:"); scanf("%d%*c",&minlim); printf("Pleaseinputthemaximumlimit:"); scanf("%d%*c",&maxlim); if(maxlim<minlim) { printf("Inputerror!\n"); return; } for(p=head;p!=NULL;p=p->next) { for(i=0;i<num_of_sub;i++) { if(p->score[i]<minlim||p->score[i]>maxlim) { if(!n) printf("Thesedatahasbeenwronglyinputed:\n"); printf("%s's%sscore.\n",p->name,subcall[i]); n++; } } } printf("Altogether%dwrongdata.\n",n);}voidModify(structdata*head){ structdata*p; charmodname[LENGTH],modscore[LENGTH]; charreply,c; inti; system("cls"); do { printf("Pleaseinputthenameofthestudentwhosedatayouwanttomodify:"); scanf("%s%*c",modname); for(p=head;p!=NULL&&strcmp(p->name,modname)!=0;p=p->next); if(p==NULL) printf("Thestudentdoesn'texist!\n"); else { printf("Successfullyfound!\n"); while(1) {printf("Doyouwanttomodifythestudent'snumber(Y/Nory/n)?"); reply=getchar(); if(reply=='\n') continue; else c=getchar(); if((reply=='Y'||reply=='N'||reply=='y'||reply=='n')&&c=='\n') break; elseif(c!='\n') while(c=getchar()!='\n'); } if(reply=='Y'||reply=='y') { printf("Pleaseinputthestudent'snewnumber:"); scanf("%s%*c",p->num); } while(1) {printf("Doyouwanttomodifythestudent'sscore(Y/Nory/n)?"); reply=getchar(); if(reply=='\n') continue; else c=getchar(); if((reply=='Y'||reply=='N'||reply=='y'||reply=='n')&&c=='\n') break; elseif(c!='\n') while(c=getchar()!='\n'); } if(reply=='Y'||reply=='y') { do { printf("Pleaseinputthenameofthesubjectwhosescoreyouwanttomodify:"); scanf("%s%*c",modscore); for(i=0;i<num_of_sub;i++) { if(strcmp(subcall[i],modscore)==0) { p->sum-=p->score[i]; printf("Pleaseinput%s'snew%sscore:",p->name,modscore); scanf("%f%*c",&p->score[i]); p->sum+=p->score[i]; break; } } if(i==num_of_sub) printf("Thesubjectdoesn'texist!\n"); while(1) {printf("Doyouwanttogoonmodifyingthestudent'sotherscoresofsubject(Y/Nory/n)?"); reply=getchar(); if(reply=='\n') continue; else c=getchar(); if((reply=='Y'||reply=='N'||reply=='y'||reply=='n')&&c=='\n') break; elseif(c!='\n') while(c=getchar()!='\n'); } } while(reply=='Y'||reply=='y'); p->aver=p->sum/num_of_sub; } } while(1) {printf("Doyouwanttogoonmodifyingotherstudents'data(Y/Nory/n)?"); reply=getchar(); if(reply=='\n') continue; else c=getchar(); if((reply=='Y'||reply=='N'||reply=='y'||reply=='n')&&c=='\n') break; elseif(c!='\n') while(c=getchar()!='\n'); } } while(reply=='Y'||reply=='y');}voidList(structdata*head){ structdata*p; intn1=0,n2=0,k,i; system("cls"); printf("name"); for(p=head;p!=NULL;p=p->next) { k=strlen(p->name); n1=(n1>k)?n1:k; } n1=(n1>4)?n1:4; for(i=0;i<n1-4;i++) putchar(''); printf("number"); for(p=head;p!=NULL;p=p->next) { k=strlen(p->num); n2=(n2>k)?n2:k; } n2=(n2>6)?n2:6; for(i=0;i<n2-6;i++) putchar(''); for(i=0;i<num_of_sub;i++) printf("%s",subcall[i]); if(num_of_sub>0) printf("sumaver"); putchar('\n'); for(p=head;p!=NULL;p=p->next) { printf("%s",p->name); k=strlen(p->name); for(i=0;i<n1-k;i++) putchar(''); printf("%s",p->num); k=strlen(p->num); for(i=0;i<n2-k;i++) putchar(''); for(i=0;i<num_of_sub;i++) { printf("%.1f",p->score[i]); k=strlen(subcall[i]); for(;k-4>0;k--) putchar(''); } if(num_of_sub>0) printf("%.2f%.2f",p->sum,p->aver); putchar('\n'); } printf("Altogether%drecords.\n",num_of_stu);}voidSearch(structdata*head){ structdata*p; charfindname[LENGTH]={'\0'}; charfindnum[LENGTH]={'\0'}; charreply,c; intflag,n1,n2,k,i; system("cls"); do { printf("Doyouwanttosearchthestudentbyname(enter1)orbynumber(enter2)?"); scanf("%d%*c",&flag); } while(flag!=1&&flag!=2); do { if(flag==1) { printf("Pleaseinputthenameofthestudentyouarefinding:"); scanf("%s%*c",findname); } else { printf("Pleaseinputthenumberofthestudentyouarefinding:"); scanf("%s%*c",findnum); } for(p=head;p!=NULL;p=p->next) { if(strcmp(p->name,findname)==0||strcmp(p->num,findnum)==0) { printf("successfullyfound:\nname"); n1=strlen(p->name); n1=(n1>4)?n1:4; for(i=0;i<n1-4;i++) putchar(''); printf("number"); n2=strlen(p->num); n2=(n2>6)?n2:6; for(i=0;i<n2-6;i++) putchar(''); for(i=0;i<num_of_sub;i++) printf("%s",subcall[i]); if(num_of_sub>0) printf("sumaver"); putchar('\n'); printf("%s",p->name); k=strlen(p->name); for(i=0;i<n1-k;i++) putchar(''); printf("%s",p->num); k=strlen(p->num); for(i=0;i<n2-k;i++) putchar(''); for(i=0;i<num_of_sub;i++) { printf("%.1f",p->score[i]); k=strlen(subcall[i]); for(;k-4>0;k--) putchar(''); } if(num_of_sub>0) printf("%.2f%.2f",p->sum,p->aver); putchar('\n'); break; } } if(p==NULL) printf("Thestudentdoesn'texist!\n"); while(1) {printf("Doyouwanttogoonsearching(Y/Nory/n)?"); reply=getchar(); if(reply=='\n') continue; else c=getchar(); if((reply=='Y'||reply=='N'||reply=='y'||reply=='n')&&c=='\n') break; elseif(c!='\n') while(c=getchar()!='\n'); } } while(reply=='Y'||reply=='y');}structdata*Delete(structdata*head){ structdata*p,*q; chardelname[LENGTH]={'\0'}; chardelnum[LENGTH]={'\0'}; charreply,c; intflag; system("cls"); do { printf("Doyouwanttodeleteallthedata(enter1)orjustonestudent'sdata(enter2)?"); scanf("%d%*c",&flag); } while(flag!=1&&flag!=2); if(flag==1) { num_of_stu=0; free(head); printf("Successfullydeleted!\n"); returnNULL; } else { do { printf("Doyouwanttodeletethedatabyname(enter1)orbynumber(enter2)?"); scanf("%d%*c",&flag); } while(flag!=1&&flag!=2); do { if(flag==1) { printf("Pleaseinputthenameofthestudentwhosedatayouwanttodelete:"); scanf("%s%*c",delname); } else { printf("Pleaseinputthenumberofthestudentwhosedatayouwanttodelete:"); scanf("%s%*c",delnum); } for(p=head;p!=NULL;q=p,p=p->next) { if(strcmp(p->name,delname)==0||strcmp(p->num,delnum)==0) { if(p==head) head=p->next; else q->next=p->next; num_of_stu--; free(p); printf("Successfullydeleted!\n"); break; } } if(p==NULL) printf("Thestudentdoesn'texist!\n"); if(num_of_stu==0) reply='N'; else { while(1) {printf("Doyouwanttogoondeleting(Y/Nory/n)?"); reply=getchar(); if(reply=='\n') continue; else c=getchar(); if((reply=='Y'||reply=='N'||reply=='y'||reply=='n')&&c=='\n') break; elseif(c!='\n') while(c=getchar()!='\n'); } } } while(reply=='Y'||reply=='y'); returnhead; }}structdata*Sort1(structdata*head,int(*g)(float,float)){ structdata*p,*q,*t,*pf=NULL,*qf=NULL,*tf=NULL,*temp; system("cls"); for(p=head;p!=NULL;pf=t,p=t->next) { t=p; for(q=p->next;q!=NULL;qf=q,q=q->next) { if((*g)(q->sum,t->sum)) { t=q; tf=qf; } } if(t!=p) { if(p==head) head=t; else pf->next=t; if(t==p->next) { p->next=t->next; t->next=p; } else { temp=p->next; p->next=t->next; t->next=temp; tf->next=p; } } } List(head); returnhead;}voidSort2(structdata*head,int(*g)(float,float)){ structdata**queue=(structdata**)malloc(num_of_stu*sizeof(structdata*)); structdata*p,*t; intn1=0,n2=0,k,i,j; sy

溫馨提示

  • 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)論