C语言课程设计方案学生信息管理系统Word格式.docx

上传人:b****1 文档编号:3439517 上传时间:2023-05-01 格式:DOCX 页数:15 大小:18.34KB
下载 相关 举报
C语言课程设计方案学生信息管理系统Word格式.docx_第1页
第1页 / 共15页
C语言课程设计方案学生信息管理系统Word格式.docx_第2页
第2页 / 共15页
C语言课程设计方案学生信息管理系统Word格式.docx_第3页
第3页 / 共15页
C语言课程设计方案学生信息管理系统Word格式.docx_第4页
第4页 / 共15页
C语言课程设计方案学生信息管理系统Word格式.docx_第5页
第5页 / 共15页
C语言课程设计方案学生信息管理系统Word格式.docx_第6页
第6页 / 共15页
C语言课程设计方案学生信息管理系统Word格式.docx_第7页
第7页 / 共15页
C语言课程设计方案学生信息管理系统Word格式.docx_第8页
第8页 / 共15页
C语言课程设计方案学生信息管理系统Word格式.docx_第9页
第9页 / 共15页
C语言课程设计方案学生信息管理系统Word格式.docx_第10页
第10页 / 共15页
C语言课程设计方案学生信息管理系统Word格式.docx_第11页
第11页 / 共15页
C语言课程设计方案学生信息管理系统Word格式.docx_第12页
第12页 / 共15页
C语言课程设计方案学生信息管理系统Word格式.docx_第13页
第13页 / 共15页
C语言课程设计方案学生信息管理系统Word格式.docx_第14页
第14页 / 共15页
C语言课程设计方案学生信息管理系统Word格式.docx_第15页
第15页 / 共15页
亲,该文档总共15页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

C语言课程设计方案学生信息管理系统Word格式.docx

《C语言课程设计方案学生信息管理系统Word格式.docx》由会员分享,可在线阅读,更多相关《C语言课程设计方案学生信息管理系统Word格式.docx(15页珍藏版)》请在冰点文库上搜索。

C语言课程设计方案学生信息管理系统Word格式.docx

/*电话号码*/

charmail[30]。

/*电子邮件地址*/

}stu[N]。

intk=1,n,m。

/*定义全局变量*/

voidreadfile()。

/*函数声明*/

voidseek()。

voidmodify()。

voidinsert()。

voiddel()。

voiddisplay()。

voidsave()。

voidmenu()。

intmain()

{

while(k)

menu()。

system("

pause"

)。

return0。

}

voidhelp()

printf("

\n0.欢迎使用系统帮助!

\n"

\n1.进入系统后,先刷新学生信息,再查询。

\n2.按照菜单提示键入数字代号。

\n3.增加学生信息后,切记保存按。

\n4.谢谢您的使用!

voidreadfile()/*建立信息*/

char*p="

student.txt"

FILE*fp。

inti=0。

if((fp=fopen("

"

r"

))==NULL)

Openfile%serror!

Strikeanykeytoexit!

"

p)。

exit(0)。

}

while(fscanf(fp,"

%s%s%d%s%s%s%s%s"

stu[i].code,stu[i].name,&

stu[i].age,

stu[i].sex,stu[i].time,stu[i].add,stu[i].tel,stu[i].mail)==8)

i++。

i=i。

fclose(fp)。

n=i。

录入完毕!

voidseek()/*查找*/

inti,item,flag。

chars1[21]。

/*以姓名和学号最长长度+1为准*/

------------------\n"

-----1.按学号查询-----\n"

-----2.按姓名查询-----\n"

-----3.退出本菜单-----\n"

while

(1)

请选择子菜单编号:

scanf("

%d"

&

item)。

flag=0。

switch(item)

case1:

请输入要查询的学生的学号:

%s"

s1)。

for(i=0。

i<

n。

i++)

if(strcmp(stu[i].code,s1)==0)

flag=1。

学生学号学生姓名年龄性别出生年月地址电话E-mail\n"

--------------------------------------------------------------------\n"

%6s%7s%6d%5s%9s%8s%10s%14s\n"

stu[i].code,stu[i].name,stu[i].age,

stu[i].sex,stu[i].time,stu[i].add,stu[i].tel,stu[i].mail)。

if(flag==0)

该学号不存在!

break。

case2:

请输入要查询的学生的姓名:

if(strcmp(stu[i].name,s1)==0)

该姓名不存在!

case3:

return。

default:

请在-3之间选择\n"

voidmodify()/*修改信息*/

inti,item,num。

charsex1[3],s1[LEN+1],s2[LEN+1]。

请输入要要修改的学生的学号:

if(strcmp(stu[i].code,s1)==0)/*比较字符串是否相等*/

num=i。

1.修改姓名\n"

2.修改年龄\n"

3.修改性别\n"

4.修改出生年月\n"

5.修改地址\n"

6.修改电话号码\n"

7.修改E-mail地址\n"

8.退出本菜单\n"

请输入新的姓名:

s2)。

strcpy(stu[num].name,s2)。

请输入新的年龄:

stu[num].age)。

break。

请输入新的性别:

sex1)。

strcpy(stu[num].sex,sex1)。

case4:

请输入新的出生年月:

strcpy(stu[num].time,s2)。

case5:

请输入新的地址:

strcpy(stu[num].add,s2)。

case6:

请输入新的电话号码:

strcpy(stu[num].tel,s2)。

case7:

请输入新的E-mail地址:

strcpy(stu[num].mail,s2)。

case8:

请在-8之间选择\n"

voidsort()/*按学号排序*/

inti,j,*p,*q,s。

chartemp[10]。

n-1。

for(j=n-1。

j>

i。

j--)

if(strcmp(stu[j-1].code,stu[j].code)>

0)

strcpy(temp,stu[j-1].code)。

strcpy(stu[j-1].code,stu[j].code)。

strcpy(stu[j].code,temp)。

strcpy(temp,stu[j-1].name)。

strcpy(stu[j-1].name,stu[j].name)。

strcpy(stu[j].name,temp)。

strcpy(temp,stu[j-1].sex)。

strcpy(stu[j-1].sex,stu[j].sex)。

strcpy(stu[j].sex,temp)。

strcpy(temp,stu[j-1].time)。

strcpy(stu[j-1].time,stu[j].time)。

strcpy(stu[j].time,temp)。

strcpy(temp,stu[j-1].add)。

strcpy(stu[j-1].add,stu[j].add)。

strcpy(stu[j].add,temp)。

strcpy(temp,stu[j-1].tel)。

strcpy(stu[j-1].tel,stu[j].tel)。

strcpy(stu[j].tel,temp)。

strcpy(temp,stu[j-1].mail)。

strcpy(stu[j-1].mail,stu[j].mail)。

strcpy(stu[j].mail,temp)。

p=&

stu[j-1].age。

q=&

stu[j].age。

s=*q。

*q=*p。

*p=s。

voidinsert()/*插入函数*/

inti=n,j,flag。

请输入待增加的学生数:

m)。

do

flag=1。

while(flag)

请输入第%d个学生的学号:

i+1)。

stu[i].code)。

for(j=0。

j<

j++)

if(strcmp(stu[i].code,stu[j].code)==0)

已有该学号,请检查后重新录入!

/*如有重复立即退出该层循环,提高判断速度*/

请输入第%d个学生的姓名:

stu[i].name)。

请输入第%d个学生的年龄:

stu[i].age)。

请输入第%d个学生的性别:

stu[i].sex)。

请输入第%d个学生的出生年月:

(格式:

年.月)\n"

stu[i].time)。

请输入第%d个学生的地址:

stu[i].add)。

请输入第%d个学生的电话:

stu[i].tel)。

请输入第%d个学生的E-mail:

stu[i].mail)。

i=i。

while(i<

n+m)。

n+=m。

\n\n"

sort()。

voiddel()

inti,j,flag=0。

chars1[LEN+1]。

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

for(j=i。

stu[j]=stu[j+1]。

if(flag==1)

删除成功,显示结果请选择菜单\n"

n--。

voiddisplay()

inti。

所有学生的信息为:

%6s%7s%5d%5s%9s%8s%10s%14s\n"

voidsave()

fp=fopen("

w"

/*写入*/

fprintf(fp,"

%s%s%d%s%s%s%s%s\n"

voidmenu()/*界面*/

intnum。

\n\n电信学生信息管理系统\n\n"

*****************\n\n"

*制作人:

李洋*\n\n"

*********************系统功能菜单************************\n"

友情提醒:

查询前请先刷新系统!

\n"

--------------------------------------------\n"

*********************************************\n"

*0.系统帮助及说明**1.刷新学生信息*\n"

*2.查询学生信息**3.修改学生信息*\n"

*4.增加学生信息**5.按学号删除信息*\n"

*6.显示当前信息**7.保存当前学生信息*\n"

********************************************\n"

*8.退出系统*\n"

**********************\n"

请选择菜单编号:

num)。

switch(num)

case0:

help()。

readfile()。

seek()。

modify()。

insert()。

del()。

display()。

save()。

k=0。

版权申明

本文部分内容,包括文字、图片、以及设计等在网上搜集整理。

版权为潘宏亮个人所有

Thisarticleincludessomeparts,includingtext,pictures,anddesign.CopyrightisPanHongliang'

spersonalownership.

用户可将本文的内容或服务用于个人学习、研究或欣赏,以及其他非商业性或非盈利性用途,但同时应遵守著作权法及其他相关法律的规定,不得侵犯本网站及相关权利人的合法权利。

除此以外,将本文任何内容或服务用于其他用途时,须征得本人及相关权利人的书面许可,并支付报酬。

Usersmayusethecontentsorservicesofthisarticleforpersonalstudy,researchorappreciation,andothernon-commercialornon-profitpurposes,butatthesametime,theyshallabidebytheprovisionsofcopyrightlawandotherrelevantlaws,andshallnotinfringeuponthelegitimaterightsofthiswebsiteanditsrelevantobligees.Inaddition,whenanycontentorserviceofthisarticleisusedforotherpurposes,writtenpermissionandremunerationshallbeobtainedfromthepersonconcernedandtherelevantobligee.

转载或引用本文内容必须是以新闻性或资料性公共免费信息为使用目的的合理、善意引用,不得对本文内容原意进行曲解、修改,并自负版权等法律责任。

Reproductionorquotationofthecontentofthisarticlemustbereasonableandgood-faithcitationfortheuseofnewsorinformativepublicfreeinformation.Itshallnotmisinterpretormodifytheoriginalintentionofthecontentofthisarticle,andshallbearlegalliabilitysuchascopyright.

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

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

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2