學(xué)生選課管理系統(tǒng)c語言程序_第1頁
學(xué)生選課管理系統(tǒng)c語言程序_第2頁
學(xué)生選課管理系統(tǒng)c語言程序_第3頁
學(xué)生選課管理系統(tǒng)c語言程序_第4頁
學(xué)生選課管理系統(tǒng)c語言程序_第5頁
已閱讀5頁,還剩125頁未讀, 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

#include<stdio.h>#include<stdlib.h>#include<string.h>structcouse*head1;structstudent*head2;structcouse//課程信息結(jié)構(gòu)體{intnum1;//課程編號charname1[20];//課程名稱chartype[20];//課程性質(zhì)inthour;//總學(xué)時intteach;//上課學(xué)時intexp;//實驗上機學(xué)時intcredit;//學(xué)分intsemester;//開課學(xué)期intnelepeo;//課程已選人數(shù)intMelepeo限structcousenext;structstudent//學(xué)生信息結(jié)構(gòu)體{charname[20];選課程編號charnelename[10][20];量//已選課程數(shù)獲得的學(xué)分structstudent*next;voidmanger();voidstudent();voidmanagementc();voidmanagements();voidmanage();voidmain();voidintoc{FILE*fp;uctcousepcharfilepath[30];printf("\t\t\t***************************\n");printf("\n\t\t\t\t歡迎使用此系統(tǒng)!\n");printf("\t\t\t***************************n;printf("輸入路徑:");argets(filepath);if((fp=fopen(filepath,"w"))==NULL){printf("無法儲存!");}p=head1;while(p!=NULL){fprintf(fp,"%d%s%s%d%d%d%d%d%d%d\n",p->num1,p->name1,p->type,p->hour,p->teach,p->exp,p->credit,p->semester,p->nelepeo,p->Melepeo);p=p->next;}osefp}voidkeyboardc()//錄入課程子函數(shù)(從鍵盤錄入){structcouse*p1,*p2;N1=0;printf("\t\t\t***************************n;printf("\t\t\t***************************\n");上限\n");scanf("%d%s%s%d%d%d%d%d%d%d",&p1->num1,p1->name1,&p1->type,&p1->hour,&p1->teach,&p1->exp,&p1->credit,&p1->semester,&p1->nelepeo,&p1->Melepeo);head1=NULL;while(p1->num1!=0){N1=N1+1;adpelsep2->next=p1;//對這段語句有疑問pp;p1=(struct*)malloc(sizeof(structcouse));scanf("%d%s%s%d%d%d%d%d%d%d",&p1->num1,p1->name1,p1->type,&p1->hour,&p1->teach,&p1->exp,&p1->credit,&p1->semester,&p1->nelepeo,&p1->Melepeo);}p2->next=NULL;}voidfilec()//錄入鍵盤子函數(shù)(從文件錄入){FILE*fp;charfilepath[20];structcouse*p1,*p2;N1=0;printf("\t\t\t***************************\n");printf("\n\t\t\t\t歡迎使用此系統(tǒng)!\n");printf("\t\t\t***************************n;printf("輸入要讀入的文件路徑:");argets(filepath);if((fp=fopen(filepath,"rb"))==NULL){件!\n",filepath);}p1=p2=(structcouse*)malloc(sizeof(structcouse));fscanf(fp,"%d%s%s%d%d%d%d%d%d%d",&p1->num1,p1->name1,p1->type,&p1->hour,&p1->teach,&p1->exp,&p1->credit,&p1->semester,&p1->nelepeo,&p1->Melepeo);head1=NULL;while(!feof(fp)){N1=N1+1;adpelsep2->next=p1;pp;p1=(*)malloc(sizeof(structcouse));fscanf(fp,"%d%s%s%d%d%d%d%d%d%d",&p1->num1,p1->name1,p1->type,&p1->hour,&p1->teach,&p1->exp,&p1->credit,&p1->semester,&p1->nelepeo,&p1->Melepeo);}p2->next=NULL;}voidinputc()//{printf("\t\t\t***************************\n");printf("\n\t\t\t\t歡迎使用此系統(tǒng)!\n");printf("\t\t\t***************************n;printf("\n\t\t\t1.從鍵盤錄入\n");printf("\t\t\t2.從文件錄入\n");printf("\t\t\t3.返回上一菜單\n");printf("請選擇(1~3):");nfdi{case(1):system("cls");keyboardc();system("cls");inputc();break;case(2):system("cls");filec();system("cls);inputc();break;case(3):system("cls");managementc();break;}}voidinsertc(intnum2)//課程管理子函數(shù)(修{structcouse*p1,*p2;{printf("\n\t\t\t沒有課程,無法修}p1=head1;while(num2!=p1->num1p1->next!=NULL){pp;p1=p1->next;}num{printf("\t\t\t請重新輸入數(shù)據(jù)進(jìn)行修改printf("課程編號\\課程名稱\\課程性質(zhì)課學(xué)期\\課程已選人數(shù)\\課程上限\n");scanf("%d%s%s%d%d%d%d%d%d%d%d",&p1->num1,p1->name1,p1->type,&p1->hour,&p1->teach,&p1->exp,&p1->credit,&p1->semester,&p1->nelepeo,&p1->Melepeo);}n;}{structcouse*p1,*p2;{printf("\n\t\t\t沒有課程,無法刪}p1=head1;while(num1!=p1->num1p1->next!=NULL){pp;p1=p1->next;}num{if(p1==head1)head1=p1->next;elsep2->next=p1->next;printf("已刪除該編號課程!\n");N1=N1-1;}elseprintf("無該編號的課程!\n");}voidmanagementc()//課程管理主函數(shù){numprintf("\t\t\t***************************\n");printf("\n\t\t\t\t歡迎使用此系統(tǒng)!\n");printf("\t\t\t***************************n;printf("\t\t\t1.添加課程\n");printf("\t\t\t2.修改課程\n");printf("\t\t\t3.刪除課程\n");printf("\t\t\t4.存儲課程信息\n");printf("\t\t\t5.返回上一菜單\n");printf("請選擇(1~5):");nfdi{case(1):system("cls");inputc();system("sbreak{lsprintf("\t\t\t***************************\n");printf("\n\t\t\t\t歡迎使用此printf("\t\t\t***************************n;fnscanfdnum");managementc();lsreak}{lsprintf("\t\t\t***************************\n");printf("\n\t\t\t\t歡迎使用此printf("\t\t\t***************************n;printf("請輸入要刪除課程的編scanfdnum1);nummanagementc();lsreak}case(4):system("cls");intoc();managemenkcase(5):system("cls");manage();break;}}儲學(xué)生信息{FILE*fp;structstudentp;charfilepath[30];printf("\t\t\t***************************\n");printf("\n\t\t\t\t歡迎使用此系統(tǒng)!\n");printf("\t\t\t***************************n;printf("請輸入路徑:");argets(filepath);if((fp=fopen(filepath,"wb"))==NULL){printf("\n無法儲存!");}p=head2;while(p!=NULL){fwrite(p,sizeof(structntfpp=p->next;}osefph}voidkeyboards()//錄入學(xué)生信息子函數(shù)(從鍵{structstudent*p1,*p2;N2=0;p1=p2=(structstudent*)malloc(sizeof(structstudent));printf("\t\t\t***************************\n");printf("\n\t\t\t\t歡迎使用此系統(tǒng)!\n");printf("\t\t\t***************************n;printf("學(xué)生學(xué)號\t學(xué)生姓名\t總學(xué)分scanf("%d%s%d",&p1->num2,p1->name2,&p1->score);p1->nelen=0;p1->gainscore=0;for(i=0;i<20;i++)p1->nelenum[i]=0;head2=NULL;while(p1->num2!=0){N2=N2+1;adpelsep2->next=p1;pp;p1=(structstudent*)malloc(sizeof(structstudent));scanf("%d%s%d",&p1->num2,p1->name2,&p1->score);p1->nelen=0;p1->gainscore=0;for(i=0;i<20;i++)p1->nelenum[i]=0;}p2->next=NULL;}voidfiles()//錄入學(xué)生信息子函數(shù)(從文件錄{FILE*fp;charfilepath[20];structstudent*p1,*p2;N2=0;printf("\t\t\t***************************\n");printf("\n\t\t\t\t歡迎使用此系統(tǒng)!\n");printf("\t\t\t***************************n;printf("輸入要讀入的文件路徑:");argets(filepath);if((fp=fopen(filepath,"rb"))==NULL){件!\n",filepath);}p1=p2=(structstudent*)malloc(sizeof(structstudent));fread(p1,sizeof(structntfphead2=NULL;while(!feof(fp)){N2=N2+1;adpelsep2->next=p1;pp;p1=(structstudent*)malloc(sizeof(structstudent));fread(p1,sizeof(structntfp}p2->next=NULL;}voidinputs()//錄入學(xué)生信息主函數(shù){printf("\t\t\t***************************\n");printf("\n\t\t\t\t歡迎使用此系統(tǒng)!\n");printf("\t\t\t***************************n;printf("\n\t\t\t1.從鍵盤錄入\n");printf("\t\t\t2.從文件錄入\n");printf("\t\t\t3.返回上一菜單\n");printf("請選擇(1~3):\n");scanf("%d",&i);{case(1):system("cls");keyboards();system("cls");inputs();break;case(2):system("cls");files();inputs();brcase(3):system("cls");managements();break;}}{structstudent*p1,*p2;{n");}p1=head2;while(num3!=p1->num2p1->next!=NULL){pp;p1=p1->next;}num{scanf("%d%s%d",&p1->num2,p1->name2,&p1->score);p1->nelen=0;p1->gainscore=0;for(i=0;i<20;i++)p1->nelenum[i]=0;}}{structstudent*p1,*p2;{n");}p1=head2;while(num2!=p1->num2p1->next!=NULL){pp;p1=p1->next;}num{if(p1==head2)head2=p1->next;elsep2->next=p1->next;N2=N2-1;}}voidmanagements()//學(xué)生信息管理主函數(shù){printf("\t\t\t***************************\n");printf("\n\t\t\t\t歡迎使用此系統(tǒng)!\n");printf("\t\t\t***************************n;printf("\t\t\t1.添加學(xué)生信息\n");printf("\t\t\t2.修改學(xué)生信息\n");printf("\t\t\t3.刪除學(xué)生信息\n");printf("\t\t\t4.存儲學(xué)生信息\n");printf("\t\t\t5.返回上一菜單\n");printf("請選擇(1~5):\n");scanf("%d",&i);{case(1):system("cls");inputs();system("sbreak{lsprintf("\t\t\t***************************\n");printf("\n\t\t\t\t歡迎使用此printf("\t\t\t***************************n;fnscanfdnum3);managements();reak}{lsprintf("\t\t\t***************************\n");printf("\n\t\t\t\t歡迎使用此printf("\t\t\t***************************n;fnscanfdnum2);nummanagements();reak}case(4):system("cls");intos();managemenkcase(5):system("cls");manage();break;}}voidmanage()//信息{printf("\t\t\t***************************n;printf("\t\t\t***************************n;printf("\n\t\t\t1.課程信息管理");printf("\n\t\t\t2.學(xué)生信息管理");printf("\n\t\t\t3.返回上一菜單");nfdi{case1:system("cls");managementc();break;case2:system("cls");managements();break;case3:system("cls");manger();break;}}voidlistc()//瀏覽課程信息{uctcousepp=head1;printf("\t\t\t***************************\n");printfntttt統(tǒng)!\n");printf("\t\t\t***************************n;printf("課程編號課程名稱課程性質(zhì)總學(xué)時授課學(xué)時上機學(xué)時學(xué)課學(xué)期\n");while(p!=NULL){printf("num:%6dname:%13s%13s%10d%7d%7d%12d%5d%5d\n",p->num1,p->name1,p->type,p->hour,p->teach,p->exp,p->credit,p->semestep=p->next;}}voidsearch{ructstudentpprintf("\t\t\t***************************n;printf("\t\t\t***************************\n");nfdap=head2;printf("學(xué)號學(xué)生姓名所選課程編學(xué)分\n");while(p!=NULL){{printf("%6d%13s",p->num2,p->name2);for(b=0;p->nelenum[b]!=0&&b<14;b++)printf("%d",p->nelenum[b]);printf("%10d\n",p->nelen);}p=p->next;}}voidsearch2()//{tcousepprintf("\t\t\t***************************n;printf("\t\t\t***************************\n");nfdbp=head1;printf("課程號課程名課程性質(zhì)課程學(xué)分選課人數(shù)\n");while(p!=NULL){dit{printf("%6d%13s%12s%12d%12d",p->num1,p->name1,p->type,p->credit,p->nelepeo);}p=p->next;}}voidsearch3()//{chartyp;tcousepprintf("\t\t\t***************************n;printf("\t\t\t***************************\n");printf("請輸入要查找的課程性質(zhì):");printf("選修/必修\n");anfstypp=head1;while(p!=NULL){if(strcmp(typ,(p->type))==0){printf("%6d%13s%12s%12d%12d",p->num1,p->name1,p->type,p->credit,p->nelepeo);}p=p->next;}}voidsearch4()課人數(shù)統(tǒng)計{uctcousepp=head1;printf("\t\t\t***************************n;printf("\t\t\t***************************\n");while(p!=NULL){printf("%6d%13s%12s%12d",p->num1,p->name1,p->type,p->nelepeo);p=p->next;}}voidsearchguanliyuan()//管理員信息查找函數(shù){printf("\t\t\t***************************n;printf("\t\t\t***************************\n");printf("\n\t\t\t1.按學(xué)號查找");printf("\n\t\t\t2.學(xué)分查詢");printf("\n\t\t\t3.按課程性質(zhì)查詢");printf("\n\t\t\t4.統(tǒng)計各門課程選修人數(shù)");printf("\n\t\t\t5.返回上一級菜單");nfdi{1:system("cls");search1();searchguanliyuan();break;2:system("cls");search2();searchguanliyuan();break;3:system("cls");search3();searchguanliyuan();break;4:system("cls");search4();searchguanliyuan();break;case5:system("cls");manger();break;}}voidshuru1(){//管理charkey;chara[20]={'l','z','j','t','u'};printf("\t\t\t***************************\n");printf("\t\t\t***************************\n");printf("\n");nfdmanfskey{printf("\t\t\t\t您輸入的用戶名不存在,請重新輸入\n");tostart}rcmpkeya{請重新輸入\n");tostart}lsmanger();}voidmanger()//管理員主函數(shù){printf("\t\t\t***************************\n");printf("\t\t\t***************************\n");printf("\t\t\t1.信息維護(hù)\n");printf("\t\t\t2.信息瀏覽\n");printf("\t\t\t3.信息查詢\n");printf("\t\t\t4.各科選修人數(shù)\n");printf("\t\t\t5.返回上一級菜單");scanf("%d",&i);{case1:system("cls");manage();break;2:system("cls");listc();manger();break;3:system("cls");searchguanliyuan();break;4:system("cls");search4();manger();break;case5:system("cls");main();break;}}voidelect()//學(xué)生選課{structstudents;uctcousepprintf("\t\t\t***************************n;printf("\t\t\t***************************\n");printf("請輸入您的學(xué)號:\n");nfdawhile((s->num2)!=a&&s->next!=NULL){n;start}len{printf("您的學(xué)分已滿");}printf("請輸入您要選修的課程編號:");nfdbp=head1;while((p->num1)!=b&&p->next!=NULL)p=p->next;{printf("您輸入的課程不存在,請重新輸n;tostart}if((p->nelepeo)>=(p->Melepeo)){tostart}for(i=0;(s->nelenum[i])!=0;i++);lenumibinscorepcredifor(j=0;j<20;j++)printf("選課成功\n");}{printf("\t\t\t***************************n;printf("\t\t\t***************************\n");printf("\n\t\t\t1.按學(xué)號查找");printf("\n\t\t\t2.學(xué)分查詢");printf("\n\t\t\t3.按課程性質(zhì)查詢");printf("\n\t\t\t4.統(tǒng)計各門課程選修人數(shù)");printf("\n\t\t\t5.返回上一級菜單");nfdi{1:system("cls");search1();searchstu();bre2:system("cls");search2();searchstu();bre3:system("cls");search3();searchstu();bre

溫馨提示

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

評論

0/150

提交評論