学生选课系统源代码Word文件下载.docx

上传人:b****6 文档编号:19471598 上传时间:2023-01-06 格式:DOCX 页数:23 大小:18.23KB
下载 相关 举报
学生选课系统源代码Word文件下载.docx_第1页
第1页 / 共23页
学生选课系统源代码Word文件下载.docx_第2页
第2页 / 共23页
学生选课系统源代码Word文件下载.docx_第3页
第3页 / 共23页
学生选课系统源代码Word文件下载.docx_第4页
第4页 / 共23页
学生选课系统源代码Word文件下载.docx_第5页
第5页 / 共23页
点击查看更多>>
下载资源
资源描述

学生选课系统源代码Word文件下载.docx

《学生选课系统源代码Word文件下载.docx》由会员分享,可在线阅读,更多相关《学生选课系统源代码Word文件下载.docx(23页珍藏版)》请在冰豆网上搜索。

学生选课系统源代码Word文件下载.docx

{

intnum1;

charname1[20];

intscore;

intnelepeo;

//课程已选人数

intMelepeo;

//课程人数上限

structcouse*next;

};

structstudent//学生信息结构体

intnum2;

charname2[20];

intnelenum[50];

//已选课程编号

intnelen;

//已选课程数量

structstudent*next;

voidMs()

for(kk1=0;

kk1<

1100;

kk1++)

for(kk2=0;

kk2<

1200;

kk2++)

for(kk3=0;

kk3<

kk3++);

}

voidkeyboardc()//录入课程子函数(从键盘录入)

structcouse*p1,*p2;

N1=0;

p1=p2=(structcouse*)malloc(sizeof(structcouse));

printf("

课程编号\t课程名称\t学分\t课程人数上限\n"

);

scanf("

%d%s%d%d"

&

p1->

num1,p1->

name1,&

score,&

Melepeo);

nelepeo=0;

head1=NULL;

while(p1->

num1!

=0)

N1=N1+1;

if(N1==1)head1=p1;

elsep2->

next=p1;

p2=p1;

p1=(structcouse*)malloc(sizeof(structcouse));

p2->

next=NULL;

voidfilec()//录入键盘子函数(从文件录入)

FILE*fp;

charfilepath[20];

输入要读入的文件路径:

"

getchar();

gets(filepath);

if((fp=fopen(filepath,"

r"

))==NULL)

{

找不到%s文件!

\n"

filepath);

exit(0);

}

fscanf(fp,"

%d%s%d%d%d"

nelepeo,&

head1=NULL;

while(!

feof(fp))

{

elsep2->

p2=p1;

p1=(structcouse*)malloc(sizeof(structcouse));

voidinputc()//录入课程主函数

inti;

\t\t\t录入课程信息\n"

\n1.从键盘录入\n"

2.从文件录入\n"

3.返回主菜单\n"

请选择(1~3):

%d"

i);

switch(i)

case

(1):

keyboardc();

break;

case

(2):

filec();

case(3):

voidinsertc(structcouse*incouse)//课程管理子函数(增加课程)

structcouse*p0,*p1,*p2;

p1=head1;

p0=incouse;

if(head1==NULL)

head1=p0;

p0->

else

while((p0->

num1>

p1->

num1)&

&

(p1->

next!

=NULL))

p1=p1->

next;

if(p0->

num1<

=p1->

num1)

if(head1==p1)head1=p0;

next=p0;

voiddelc(intnum1)//课程管理子函数(删除课程)

\n没有课程,无法删除!

gotoend;

while(num1!

=p1->

num1&

=NULL)

if(num1==p1->

if(p1==head1)head1=p1->

next=p1->

已删除该编号课程!

N1=N1-1;

elseprintf("

无该编号的课程!

end:

;

voidmanagementc()//课程管理主函数

structcouse*incouse;

inti,num1;

\t\t\t课程管理\n"

1.新增课程\n"

2.删除课程\n"

incouse=(structcouse*)malloc(sizeof(structcouse));

incouse->

num1,incouse->

insertc(incouse);

请输入要删除课程的编号:

num1);

delc(num1);

case(3):

voidkeyboards()//录入学生信息子函数(从键盘录入)

structstudent*p1,*p2;

N2=0;

p1=p2=(structstudent*)malloc(sizeof(structstudent));

printf("

学生学号\t学生姓名\n"

scanf("

%d%s"

num2,p1->

name2);

nelen=0;

for(i=0;

i<

20;

i++)p1->

nelenum[i]=0;

head2=NULL;

while(p1->

num2!

N2=N2+1;

if(N2==1)head2=p1;

p1=(structstudent*)malloc(sizeof(structstudent));

}

p2->

voidfiles()//录入学生信息子函数(从文件录入)

inti=0;

N2=0;

p1=p2=(structstudent*)malloc(sizeof(structstudent));

fread(p1,sizeof(structstudent),1,fp);

i=0;

if(N2==1)head2=p1;

voidinputs()//录入学生信息主函数

\t\t\t录入学生信息\n"

keyboards();

files();

voidinserts(structstudent*incouse)//学生信息管理子函数(填加学生信息)

structstudent*p0,*p1,*p2;

p1=head2;

if(head2==NULL)

head2=p0;

num2>

num2)&

num2<

num2)

if(head2==p1)head2=p0;

voiddels(intnum2)//学生信息管理子函数(删除学生信息)

\n没有该学生信息,无法删除!

while(num2!

num2&

if(num2==p1->

if(p1==head2)head2=p1->

已删除该学生信息!

N2=N2-1;

无该学号的学生!

voidmanagements()//学生信息管理主函数

structstudent*incouse;

inti,num2;

\t\t\t学生信息管理\n"

1.新增学生信息\n"

2.删除学生信息\n"

incouse=(structstudent*)malloc(sizeof(structstudent));

nelenum[0]=0;

num2,incouse->

inserts(incouse);

请输入要删除学生的学号:

num2);

dels(num2);

voidelect(structstudent*s)//选课

structcouse*p;

intnum1,i;

请输入要选课的编号:

s->

nelenum[i]!

=0;

i++);

nelenum[i]=num1;

(s->

nelen)++;

p=head1;

while(p->

=num1)p=p->

(p->

nelepeo)++;

voidcheak()//学生选课子函数(查询可选课程)

chare;

structcouse*c;

structstudent*s;

intnum2,i,j=0,t=0;

请输入你的学号:

s=head2;

while(s->

=num2&

s->

=NULL)s=s->

if(s->

=num2)

不存在你的信息,请进入主菜单录入你的信息!

gotoend;

c=head1;

你的可选课程编号:

while(c!

for(t=0,i=0;

i++)

if(c->

num1==s->

nelenum[i])t=1;

if(t==0&

(c->

nelepeo!

=c->

Melepeo))

%d\n"

c->

j++;

c=c->

if(j==0)

你已选完所有课程,无法再多选!

选课(y/n)?

:

e=getchar();

while(e=='

y'

elect(s);

继续选课(y/n)?

voidback(structstudent*p)//退课

structcouse*p1;

intnum1,i,j;

请输入你要退掉的课程编号:

=num1)p1=p1->

p->

=num1;

for(j=i;

nelenum[j]!

j++)p->

nelenum[j]=p->

nelenum[j+1];

nelenum[--j]=0;

(p1->

nelepeo)--;

退课成功!

voidhcheak()//学生选课子函数(查询已选课程)

charc;

structcouse*p0;

structstudent*p;

intnum2,i,f=0;

请输入学号:

p=head2;

p!

=NULL)p=p->

if(p==NULL)

不存在你的信息,请回主菜单录入信息:

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 表格模板 > 合同协议

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1