宿舍管理系统c语言程序设计内容摘要:

ets(); fflush(stdin); printf(★请你输入密码: \n); ch=getch(); for(i=0; ch。 =39。 \r39。 ; i++) { [i]=ch; printf(*); if(ch==8) printf(\b\b\b\b); ch=getch(); fflush(stdin); } [i]=0; str1=strcmp(,); str2=strcmp(,); if(str1==0amp。 amp。 str2==0) return(1); else printf(登录失败。 \n); flag=0; } break; case 3: exit(1); } } return(0); } struct node*creat()//*创建链表 { struct node*head,*p1,*p2; int i; char c=39。 y39。 ; head=(struct node*)malloc(sizeof(struct node)); //*创建头结点 headnext=NULL; p1=head; for(i=0; c==39。 y39。 ; )//*创建信息小提示 { system(cls); p2=(struct node*)malloc(sizeof(struct node)); printf(★输入第 %d 个人的信息: \n,++i); //输入学生信息 printf(姓名 \t班级 \t\t 性别 \t 年龄 \t学号 \t楼栋号 \t 宿舍号 \n);fflush(stdin); gets(p2name); fflush(stdin); gets(p2Class); fflush(stdin); scanf(%c,amp。 p2sex); for(; p2sex。 =39。 f39。 amp。 amp。 p2sex。 =39。 m39。 ; ) { printf(★性别输入有误 ,你必须正确输入 39。 f39。 或者 39。 m39。 \n); fflush(stdin); scanf(%c,amp。 p2sex); } fflush(stdin); scanf(%d,amp。 p2age); while(p2age 16||p2age 30) { printf(★你输入的年龄段不在 1630 之间 ,请重新输入。 \n); scanf(%d,amp。 p2age); } scanf(%ld,amp。 p2stunum); while(p2stunum 100000||p2stunum=1000000) { printf(★你输入的学号不是六位数 ,请重新输入。 \n); scanf(%ld,amp。 p2stunum); } scanf(%d,amp。 p2dornum); while(p2dornum 16||p2dornum 1) { printf(★你输入的公寓号不在 116之间 ,请重新输入。 \n); scanf(%d,amp。 p2dornum); } scanf(%d,amp。 p2roomnum); p1next=p2; p1=p2; printf(★还要输入学生信息吗 ,输入 (y or n?)\n); c=getch(); fflush(stdin); system(cls); } p1next=NULL; return(head); } void save(struct node*head)//*保存文件 { struct node*p2; FILE*fp; if((fp=fopen(f: /,wt))==NULL) { printf(写文件出错,按任意键退出。 ); getch(); exit(1); } for(p2=headnext; p2。 =NULL; p2=p2next) fprintf(fp,%s\t%s\t%c\t%d\t%d\t%d\t%d\n, p2name,p2Class,p2sex,p2age,p2stunum,p2dornum,p2roomnum); getch(); fclose(fp); } void show(void)//*菜单显示 { printf(\n); printf($$$$$$$$$$欢迎进入学生宿舍信息管理系统。 $$$$$$$$$$\n); printf(\n); printf(宿舍是我家 ,爱护靠大家 \n); printf(\n); printf(|*|\n); printf(||\n); printf(|▲ ); printf(\t▲ ); printf(\t▲ |\n); printf(||\n); printf(|▲ ); printf(\t▲ ); printf(\t▲ |\n); printf(||\n); printf(|▲ ); printf(\t▲ ); printf(▲ |\n); printf(||\n); printf(|*|\n); printf(请输入你的选择的信息处理方式的序号。 \n); } void show1(void) { printf(*\n); printf(。 创建信息小提示: \n); printf(\n); printf(\n); printf(◆ 39。 f39。 或者 39。 m39。 其他均认为是错误操作。 \n); printf(\n); printf(◆ 1630之间 ,其他均认为是错误操作。 \n); printf(\n); printf(◆ ,如果学号少于或大于六位数字 ,系统认为此操作为非法操作。 \n); printf(\n); printf(◆ 116之间,其他数字均认为是错误操作。 \n); printf(\n); printf(◆ ,故宿舍号在下列范围内 ,其他区间均认为是非法操作: \n); printf(\n); printf(▲一楼 101150\t 二楼 201250\t三楼 301350\n); printf(\n); printf(▲四楼 401450\t 五楼 501550\n); printf(\n); printf(\n); printf(*\n); } struct node*read1(void) { struct node*head,*p1,*p2; FILE*fp; if((fp=fopen(f: /,rt))==NULL) { printf(★读取信息错误。 ,按任意键退出。 ); getch(); exit(1); } head=(struct node*)malloc(sizeof(struct node)); headnext=NULL; p1=head; while(。 feof(fp)) { p2=(struct node*)malloc(sizeof(struct node)); fscanf(fp,%s\t%s\t%c\t%d\t%d\t%d\t%d\n, p2name,p2Class,amp。 p2sex,amp。 p2age,amp。 p2stunum,amp。 p2dornum,amp。 p2roomnum); p1next=p2; p1=p2; } p1next=NULL; fclose(fp); return(head); } void readout(void)//*从磁盘中读取信息显示在屏幕上 { struct node*head,*p1,*p2; FILE*fp; if((fp=fopen(f: /,rt))==NULL) { printf(★读取信息错误。 ,按任意键退出。 ); getch(); exit(1); } head=(struct node*)malloc(sizeof(struct node)); hea。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。