资源描述:
《学生信息管理系统2》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、学生信息管理系统2#include#include#include#includeenumSex{male,female};/*性别*/enumEducation{high,junior,college,master,doctor};/*正在攻读的学历*/structDate/*出生日期*/{intyear;intmouth;intday;};structInfo/*学生资料*/{charnum[12];/*学号*/charname[15];/*姓名*/enumSexsex;/*性别*/
2、structDatebirthday;/*出生日期*/enumEducationesucation;/*正在攻读的学历*/charadr;/*住址*/chartel[11];/*电话*/};intmenu()/*菜单选择函数*/{intn;system("cls");/*清屏*/puts("ttWelcometostudentmanagementsystem");puts("tt************************Menu************************");puts("tttt1.Appendinform")
3、;puts("tttt2.Displayinform");puts("tttt3.Searchinform");puts("tttt4.Modifyinform");puts("tttt5.Deleteinform");puts("tttt6.Exit");puts("tt*****************************************************");while(1){scanf("%d",&n);if(n<1
4、
5、n>6)printf("Inputer
6、ror,pleaseinputagain(1-6):");elsebreak;}returnn;}voidappend()/*信息输入函数*/{structInfoinfo;FILE*fp;/*注意*/charch;chartemp[6];if((fp=fopen("d:\program\exal.txt","w"))==NULL){printf("tCannotopentheinformfile!");getch();exit(1);}do{printf("tnum:");gets(info.num);printf("tname:");gets(
7、info.name);printf("tsex(maleorfemale):");gets(temp);if(strcmp(temp,"female")==0)info.sex=female;elseinfo.sex=male;printf("tbirthday:");scanf("%d-%d-%d",&info.birthday.year,&info.birthday.month,&info.birthday.day);getchar();/*注意*/printf("teducation:");gets(temp);if(strcmp(temp,"doc
8、tor")==0)info.education=doctor;elseif(strcmp(temp,"master")==0)info.education=master;elseif(strcmp(temp,"college")==0)info.education=college;elseif(strcmp(temp,"junior")==0)info.education=junior;elseinfo.education=high;printf("taddress:");gets(info.addr);printf("ttelephone:");gets(
9、info.tel);printf("tAnymore?(yes/no):[]");/*注意*/ch=getchar();getchar();/*注意*/}while(ch=="yes"
10、
11、ch=="no");fclose(fp);}voidprint1(){printf("%-12s%-15s%-6s%-8s%-15s%-20s%-11s","num","name","sex","birthday","education","address","telephone");}voidprint2(structInfoinfo){printf("%-12s%-1
12、5s",info.num