小区物业管理程序总程序

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

//.....................................................................................................//#includestdio.h#includestring.h#includestdlib.hvoidprint();voidjifeibaobiao(structyezhu_typeye[],intn);//报表voidliulan(structyezhu_typeye[],intn);//浏览voidtianjia(structyezhu_typeye[],inti);//添加voiddelate(structyezhu_typeye[],intn);//删除intcharu(structyezhu_typeye[],intn);//插入voidxiugai(structyezhu_typeye[],intn);//修改voidrnumcha(structyezhu_typeye[],intn);//房号查询voidnumcha(structyezhu_typeye[],intn);//编号查询intchaxun(structyezhu_typeye[],intn);//查询intpaixu(structyezhu_typeye[],intn);//排序voidnumsort(structyezhu_typeye[],intn);//编号排序voidnamesort(structyezhu_typeee[],intn);//名字排序voidrnumsort(structyezhu_typete[],intn);//房号排序voidwatysort(structyezhu_typeye[],intn);//用水量排序voideleqsort(structyezhu_typeie[],intn);//用电量排序voidwefsort(structyezhu_typeoe[],intn);//水电费排序structyezhu_type//结构体{intnum,tele,rnum;charname[20],unit[50];floateleq,waty,strf,wef;}ye[20];//............................................................................................................//voidmain(){print();inta,b,i,d,n;FILE*fp;do{printf(请输入用户名:\n);scanf(%d,&a);printf(请输入密码:\n);scanf(%d,&b);if(a!=114&&b!=1234){printf(用户名或密码错误请重输\n);}}while(a!=114&&b!=1234);printf(请输入业主个数\n);scanf(%d,&n);printf(请输入业主信息,编号,电话,房号,名字,地址,用水量,用电量,水电费,物业费\n);for(i=0;in;i++){scanf(%d%d%d%s%s%f%f%f%f,&ye[i].num,&ye[i].tele,&ye[i].rnum,ye[i].name,ye[i].unit,&ye[i].waty,&ye[i].eleq,&ye[i].strf,&ye[i].wef);}if((fp=fopen(d:\\业主信息.txt,w))==NULL){printf(cannotfoundfile!\n);exit(1);}fprintf(fp,编号电话房号名字地址用电量用水量物业费水电费\n);//写入文件for(i=0;in;i++){fprintf(fp,%4d%8d%7d%8s%8s%9.1f%10.1f%10.1f%9.1f\n,ye[i].num,ye[i].tele,ye[i].rnum,ye[i].name,ye[i].unit,ye[i].eleq,ye[i].waty,ye[i].strf,ye[i].wef);}fclose(fp);{inte;printf(请选择查询方式:\n);printf(**************************************************\n);printf(**-------------------1---------------进入主菜单-**\n);printf(**-------------------2-----------------文件读取-**\n);printf(**************************************************\n);scanf(%d,&e);if(e==1){do{printf(**--*----------------主菜单---------------------**\n);printf(**--1---------------信息添加--------------------**\n);printf(**--2---------------信息修改--------------------**\n);printf(**--3---------------信息删除--------------------**\n);printf(**--4---------------信息排序--------------------**\n);printf(**--5---------------信息查询--------------------**\n);printf(**--6---------------信息插入--------一----------**\n);printf(**--7---------------信息浏览--------一----------**\n);printf(**--8---------------信息报表--------一----------**\n);printf(**--0---------------退出系统--------------------**\n);scanf(%d,&d);switch((int)d){case1:tianjia(ye,n++);break;case2:xiugai(ye,n);break;case3:delate(ye,n--);break;case4:paixu(ye,n);break;case5:chaxun(ye,n);break;case6:n=charu(ye,n);break;case7:liulan(ye,n);break;case8:jifeibaobiao(ye,n);break;case0:exit(1);}}while(d);}if(e==2){if((fp=fopen(d:\\业主信息.txt,r))==NULL){printf(cannotfoundfile\n);exit(1);}printf(编号电话房号名字地址用水量用电量水电费物业费\n);for(i=0;in;i++){printf(%9d%8d%8d%8s%7s%9.1f%9.1f%9.1f%9.1f\n,ye[i].num,ye[i].tele,ye[i].rnum,ye[i].name,ye[i].unit,ye[i].eleq,ye[i].waty,ye[i].strf,ye[i].wef);}fclose(fp);}}}//-----------------------------------------------------------------------------------------------------//voidtianjia(structyezhu_typeye[],inti)//添加{intj;FILE*fp;printf(*****************请输入业主编号*******************\n);scanf(%d,&ye[i].num);printf(*****************请输入业主名称*******************\n);scanf(%s,ye[i].name);printf(*****************请输入业主电话*******************\n);scanf(%d,&ye[i].tele);printf(*****************请输入业主房号*******************\n);scanf(%d,&ye[i].rnum);printf(*****************请输入业主单位*******************\n);scanf(%s,&ye[i].unit);printf(*****************请输入业主用电量*****************\n);scanf(%f,&ye[i].eleq);printf(*****************请输入业主用水量*****************\n);scanf(%f,&ye[i].waty);printf(*****************请输入业主物业费*****************\n);scanf(%f,&ye[i].strf);printf(*****************请输入业主水电费*****************\n);scanf(%f,&ye[i].wef);printf(添加成功\n);if((fp=fopen(d:\\业主信息.txt,w))==NULL){printf(cannotfoundfile!\n);exit(1);}fprintf(fp,编号电话房号名字地址用电量用水量物业费水电费\n);//写入文件for(j=0;ji+1;j++){fprintf(fp,%4d%8d%7d%8s%8s%9.1f%10.1f%10.1f%9.1f\n,ye[j].num,ye[j].tele,ye[j].rnum,ye[j].name,ye[j].unit,ye[j].eleq,ye[j].waty,ye[j].strf,ye[j].wef);}fclose(fp);}//................................................................................................//voidxiugai(structyezhu_typeye[],intn)//修改{FILE*fp;intk,i;printf(请输入要修改的业主编号\n);scanf(%d,&k);for(i=0;in;i++){if(ye[i].num==k){printf(请输入修改后业主的编号,名称,电话,房号,单位,用电量,用水量,物业费,水电费\n);scanf(%d%s%d%d%s%f%f%f%f,&ye[i].num,ye[i].name,&ye[i].tele,&ye[i].rnum,&ye[i].unit,&ye[i].eleq,&ye[i].waty,&ye[i].strf,&ye[i].wef);printf(修改成功\n);}}if((fp=fopen(d:\\业主信息.txt,w))==NULL){printf(cannotfoundfile!\n);exit(1);}fprintf(fp,编号电话房号名字地址用电量用水量物业费水电费\n);//写入文件for(i=0;in;i++){fprintf(fp,%4d%8d%7d%8s%8s%9.1f%10.1f%10.1f%9.1f\n,ye[i].num,ye[i].tele,ye[i].rnum,ye[i].name,ye[i].unit,ye[i].ele

1 / 17
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功