学生宿舍管理系统方案.doc

学生宿舍管理系统方案.doc

ID:58875938

大小:48.50 KB

页数:12页

时间:2020-09-21

学生宿舍管理系统方案.doc_第1页
学生宿舍管理系统方案.doc_第2页
学生宿舍管理系统方案.doc_第3页
学生宿舍管理系统方案.doc_第4页
学生宿舍管理系统方案.doc_第5页
资源描述:

《学生宿舍管理系统方案.doc》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库

1、..学生宿舍管理系统.txt52每个人都一条抛物线,天赋决定其开口,而最高点则需后天的努力。没有秋日落叶的飘零,何来新春绿芽的饿明丽?只有懂得失去,才会重新拥有。#include"stdio.h"#include"iostream.h"#include"string.h"#defineERROR0#defineOK1#defineMAXSIZE2500#defineEQ(a,b)((a)==(b))typedefintStatus;intN=4;//全局变量来储存所输入的个数;structstudent{//数据结构类型;charname

2、[10];intnum;introom;};/*--------------------------------------------------------------------------*/StatusInput(){//数据输入;inti=0;intflag=1;charch;FILE*fpdata;studentstu[MAXSIZE];if((fpdata=fopen("studata.txt","wb"))==NULL){printf("cannotopenstudata.cfile!");returnERROR;}wh

3、ile(flag){printf("是否继续输入(Y/N):");.....cin>>ch;if(ch=='y'

4、

5、ch=='Y'){scanf("%s%d%d",stu[i].name,&stu[i].num,&stu[i].room);fwrite(&stu[i],sizeof(structstudent),1,fpdata);i++;}elseflag=0;}N=i;fclose(fpdata);printf("数据输入完成!");returnOK;}StatusPrint(char*filename){//输出数据;FILE*

6、fpdata;studentst;inti=0;if((fpdata=fopen(filename,"rb"))==NULL){printf("cannotopenstudata.cfile!");returnERROR;}while(i

7、*****************************//***************************************************************/StatusNameSort(){//排序;inti,j;.....FILE*fpdata;FILE*fpnamesort;studentstu[MAXSIZE];if((fpdata=fopen("studata.txt","rb"))==NULL){printf("cannotopendata.cfile!");returnERROR;}for(i

8、=1;i<=N;i++){fread(&stu[i],sizeof(structstudent),1,fpdata);}fclose(fpdata);if((fpnamesort=fopen("namesort.txt","wb"))==NULL){printf("cannotopennsort.c");returnERROR;}for(i=2;i<=N;i++){if(strcmp(stu[i].name,stu[i-1].name)<0){strcpy(stu[0].name,stu[i].name);stu[0].num=stu[i

9、].num;stu[0].room=stu[i].room;strcpy(stu[i].name,stu[i-1].name);stu[i].num=stu[i-1].num;stu[i].room=stu[i-1].room;for(j=i-2;(strcmp(stu[0].name,stu[j].name))<0;j--){strcpy(stu[j+1].name,stu[j].name);stu[j+1].num=stu[j].num;stu[j+1].room=stu[j].room;}strcpy(stu[j+1].name,s

10、tu[0].name);stu[j+1].num=stu[0].num;stu[j+1].room=stu[0].room;}}for(i=1;i<=N;i++){fwrite(&stu[i]

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。