学生选课系统.doc_第1页
学生选课系统.doc_第2页
学生选课系统.doc_第3页
学生选课系统.doc_第4页
学生选课系统.doc_第5页
已阅读5页,还剩8页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

#include#include#includetypedef struct subjectsint num1; /char name120; /char kind10; /int stime; /int ttime; /int etime; /int score; /int term; /int yixuan_peo; /int max_peo; /struct subjects *next;SUB;typedef struct studentslong int num2; /char name220; /int yixuan_num50; /int yixuan_shu; /struct students *next;students;SUB *head1;students *head2;int i;void keyboardc()/()SUB *p1,*p2;void intoc();int N1;N1=0;p1=p2=(SUB*)malloc(sizeof(SUB);printf( n);scanf(%d %s %s %d %d %d %d %d %d %d,&p1-num1,p1-name1,p1-kind,&p1-stime,&p1-ttime,&p1-etime,&p1-score,&p1-term,&p1-yixuan_peo,&p1-max_peo);head1=NULL;while(p1-num1!=0)N1=N1+1;if(N1=1)head1=p1;else p2-next=p1;p2=p1;p1=(SUB * )malloc(sizeof(SUB);scanf(%d %s %s %d %d %d %d %d %d %d,&p1-num1,p1-name1,p1-kind,&p1-stime,&p1-ttime,&p1-etime,&p1-score,&p1-term,&p1-yixuan_peo,&p1-max_peo);p2-next=NULL;intoc();void keyboards()/students *p1,*p2;void intos();int N2=0;p1=p2=(students *)malloc(sizeof(students);printf(tn);scanf(%d%s,&p1-num2,p1-name2);p1-yixuan_shu=0;for(i=0;iyixuan_numi=0;head2=NULL;while(p1-num2!=0)N2=N2+1;if(N2=1)head2=p1;else p2-next=p1;p2=p1;p1=(students * )malloc(sizeof(students);scanf(%d%s,&p1-num2,p1-name2);p1-yixuan_shu=0;for(i=0;iyixuan_numi=0;p2-next=NULL;intos();void filein()/FILE * fp;SUB *p1,*p2;int n1=0;char filepath20;printf(:);getchar();gets(filepath);if(fp=fopen(filepath,r)=NULL)printf(%s!n,filepath);exit(0);p1=p2=(SUB*)malloc(sizeof(SUB);fscanf(fp,%d %s %s %d %d %d %d %d %d %d,&p1-num1,p1-name1,p1-kind,&p1-stime,&p1-ttime,&p1-etime,&p1-score,&p1-term,&p1-yixuan_peo,&p1-max_peo);head1=NULL;while(!feof(fp)n1=n1+1;if(n1=1)head1=p1;else p2-next=p1;p2=p1;p1=(SUB* )malloc(sizeof(SUB);fscanf(fp,%d %s %s %d %d %d %d %d %d %d,&p1-num1,p1-name1,p1-kind,&p1-stime,&p1-ttime,&p1-etime,&p1-score,&p1-term,&p1-yixuan_peo,&p1-max_peo);p2-next=NULL;fclose(fp);void fileins()/FILE *fp;students *p1,*p2;char filepath20;int n2=0;printf(:);getchar();gets(filepath);if(fp=fopen(filepath,r)=NULL)printf(%s!n,filepath);exit(0);p1=p2=(students*)malloc(sizeof(students);fread(p1,sizeof(students),1,fp);head2=NULL;while(!feof(fp)n2=n2+1;if(n2=1)head2=p1;else p2-next=p1;p2=p1;p1=(students * )malloc(sizeof(students);fread(p1,sizeof(students),1,fp);p2-next=NULL;fclose(fp);void prin() /SUB *ptr;filein();if(head1=NULL)printf(nnt*NO RECORDS!*n);printf( n);for(ptr=head1;ptr!=NULL;ptr=ptr-next)printf(%5d%12s%9s%9d%9d%11d%11d%7d%8d%8dn,ptr-num1,ptr-name1,ptr-kind,ptr-stime,ptr-ttime,ptr-etime,ptr-score,ptr-term,ptr-yixuan_peo,ptr-max_peo);void input()/int i;printf(tttn);printf(1.n);printf(2.n);printf(3.n);printf(13):n);scanf(%d,&i);switch(i)case(1):filein();printf(n);break;case(2):keyboardc();break;case(3):break;default:printf(!);void inputs()/int i;printf(tttn);printf(1.n);printf(2.n);printf(3.n);printf(13):n);scanf(%d,&i);switch(i)case(1):fileins();printf(n);break;case(2):keyboards();break;case(3):break;default:printf();void search() /SUB *ptr;int a,num;int t=1;char type10;students *ptr1;L1: printf(nntt*n);printf(nttt1-n);printf(nttt2-n);printf(nttt3-n);printf(nttt4-n);printf(nntt*n);printf(nnChoose your number(1-4): bb);scanf(%d,&a);switch(a)case 1:printf(:);scanf(%s,type);printf( n);for(ptr=head1;ptr!=NULL;ptr=ptr-next)if(strcmp(type,ptr-kind)=0)printf(%5d%12s%9s%9d%9d%11d%11d%7d%8d%8dn,ptr-num1,ptr-name1,ptr-kind,ptr-stime,ptr-ttime,ptr-etime,ptr-score,ptr-term,ptr-yixuan_peo,ptr-max_peo);t=0;if(t=1)printf(tn!n);goto L1;case 2:printf(:);scanf(%d,&num);printf( n);for(ptr=head1;ptr!=NULL;ptr=ptr-next)if(ptr-score=num)printf(%5d%12s%9s%9d%9d%11d%11d%7d%8d%8dn,ptr-num1,ptr-name1,ptr-kind,ptr-stime,ptr-ttime,ptr-etime,ptr-score,ptr-term,ptr-yixuan_peo,ptr-max_peo);t=0;if(t=1)printf(tn!n);goto L1;case 3:printf(:);scanf(%d,&num);printf( n);for(ptr1=head2;ptr1!=NULL;ptr1=ptr1-next) if(ptr1-num2=num)printf(%5d%12s%8dn,ptr1-num2,ptr1-name2,ptr1-yixuan_shu);t=0;if(t=1)printf(nt!n);goto L1;case 4:break;void myInsert(SUB* subj) /SUB *ptr,*ptr2;ptr=subj;if(head1=NULL)head1=ptr;head1-next=NULL;elsefor(ptr2=head1;ptr2;ptr2=ptr2-next)if(ptr2-next=NULL)ptr2-next=subj;subj-next=NULL;break;void insert()/SUB *ptr,*subj,*a;int size=sizeof(SUB);char ch,ch1;while(ch!=0)subj=(SUB *)malloc(size);ptr=subj;printf(:n);printf(ntt:);scanf(%d,&subj-num1);printf(ntt:);scanf(%s,&subj-name1);printf(ntt:);scanf(%s,&subj-kind);printf(ntt:);scanf(%d,&subj-stime);printf(ntt:);scanf(%d,&subj-ttime);printf(ntt:);scanf(%d,&subj-etime);printf(ntt:);scanf(%d,&subj-score);printf(ntt:);scanf(%d,&subj-term);printf(ntt:);scanf(%d,&subj-yixuan_peo);printf(ntt:);scanf(%d,&subj-max_peo);myInsert(subj);printf( n);for(a=head1;a!=NULL;a=a-next)printf(%5d%12s%9s%9d%9d%11d%11d%7d%8d%8dn,a-num1,a-name1,a-kind,a-stime,a-ttime,a-etime,a-score,a-term,a-yixuan_peo,a-max_peo);printf(nn);printf(n 0: bb);ch1=getchar(); /CH1subj-termCHCH1ch=getchar();void del() /SUB *p1,*p2;int num;printf(:);scanf(%d,&num);if(head1=NULL)printf(n,!n);goto end;p1=head1;while(num!=p1-num1 & p1-next!=NULL)p2=p1;p1=p1-next;if(num=p1-num1)if(p1=head1) head1=p1-next;free(p1);else p2-next=p1-next;free(p1);printf(!n);else printf(!n);end:;void elect()/ char c;students *s;SUB * p;int n1,n2;printf(:n);scanf(%d,&n1);s=head2;while(s-num2)!=n1)&(s!=NULL)s=s-next;if(s=NULL) printf(n);goto end;L4: printf(:n);scanf(%d,&n2);p=head1;while(p-num1)!=n2)&(p!=NULL)p=p-next;if(p=NULL)printf(n);goto end;if(p-yixuan_peo)=(p-max_peo)printf(n);goto end;for(i=0;s-yixuan_numi!=0;i+);s-yixuan_numi=n2;(s-yixuan_shu)+;(p-yixuan_peo)+;printf(n);printf(y/n)n);getchar();c=getchar();if(c=y)goto L4;end:;void hcheck()/SUB* p0;students * p;int num2,total=0;printf(:n);scanf(%d,&num2);p=head2;while(p-num2)!=num2) & (p!=NULL) p=p-next;if(p=NULL)printf(,:n);goto end;printf(:n);if(p-yixuan_num0)=0)printf(!n);goto end;for(i=0;(p-yixuan_numi)!=0;i+)printf(%dn,p-yixuan_numi);p0=head1;while(p0-num1)!=(p-yixuan_numi) p0=p0-next;total=total+p0-score;printf(:%dn,total);printf(:%dn,p-yixuan_shu);end:;void back()/ SUB *p1;char c;students *p2;int num1,num2,j;printf(:n);scanf(%d,&num2);p2=head2;while(p2-num2)!=num2) & (p2!=NULL) p2=p2-next;if(p2=NULL)printf(n);goto end;L5: printf(:n);scanf(%d,&num1);p1=head1;while(p1-num1!=num1) p1=p1-next;for(i=0;p2-yixuan_numi!=num1;i+);for(j=i;p2-yixuan_numj!=0;j+) p2-yixuan_numj=p2-yixuan_numj+1;p2-yixuan_num-j=0;p2-yixuan_shu-;(p1-yixuan_peo)-;printf(!n);printf(y/n)n);getchar();c=getchar();if(c=y)goto L5;end:;void intoc()/FILE * fp;SUB * p;char filepath30;printf(:);getchar();gets(filepath);if(fp=fopen(filepath,w)=NULL)printf(n!);exit(0);p=head1;while(p!=NULL)fprintf(fp,%d %s %s %d %d %d %d %d %d %dn,p-num1,p-name1,p-kind,p-stime,p-ttime,p-etime,p-score,p-term,p-yixuan_peo,p-max_peo);p=p-next;fclose(fp);printf(%s!n,filepath);void intos()/FILE * fp;students * p;char filepath30;printf(:);getchar();gets(filepath);if(fp=fopen(filepath,w)=NULL)printf(n!);exit(0);p=head2;while(p!=NULL)fwrite(p,sizeof(students),1,fp);p=p-next;fclose(fp);printf(%s!n,filepath);void into()/int i;printf(1.n);printf(2.n);printf(3.n);printf(13)n);scanf(%d,&i);switch(i)case(1):intoc();break;case(2):intos();break;case(3):break;void Mangers()/void Students();int n,flag=0,i=3,w=1;char s8;char password7=12345;doprintf(nnEnter password:);scanf(%s,s);if(strcmp(s,password)=0) /flag=1;break;elseprintf(nnError! You only have %d times! Enter again:n,i-1);i-;while(i0);if(flag=0)printf(you have Enter 3 times!); /3exit(0); /doprintf(nntt*nn);printf(tttt1-n);printf(tttt2-n);printf(tttt3-n);printf(tttt4-n);printf(tttt5-);printf(nntt*n);printf(Chiose your number(1-5): bb);scanf(%d,&n);switch(n)case 1:inputs();break;case 2:input();break;case 3:insert();intoc();break;case 4:del();intoc();break;case 5:w=0;break;default:printf(n:);while(w=1);int x;start:printf(nttt!n);printf(:n);printf(1.n);printf(2.n);printf(3.n);scanf(%d,&x);if(x3)printf(,!n);goto start;switch(x)case 1:Mangers() ;break;case 2:Students();break;case 3:printf(!

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论