《C语言程序设计-物业管理系统(共11页).docx》由会员分享,可在线阅读,更多相关《C语言程序设计-物业管理系统(共11页).docx(11页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、精选优质文档-倾情为你奉上#include stdio.h#include stdlib.h#include string.h#define M 5struct Peopleint a;char ming30;char xiang30;int b;int c;PM;void main()int a=1;void menu_1(int a);menu_1(a);void menu_1(int a)void menu_2();void menu_3();void biao_1();int loop=1;while(loop)system(cls);printf(t WELCOME n);print
2、f(t-(*)-n);printf(t- -n);printf(t- -n);printf(t- 1.小区用户管理 -n);printf(t- 2.物业收费管理 -n);printf(t- 3.生成小区住户收费报表 -n);printf(t- 4.退出 -n);printf(t- -n);printf(t- -n);printf(t-o()o-n);printf(t END n);printf(请输入所要选择内容的序号(1-4): bb);scanf(%d,&a);switch(a)case 1:menu_2();break;case 2:menu_3();break;case 3:biao_
3、1();break;case 4:exit(0);break;default :exit(0);getchar();getchar();void menu_2()void scan_1();void add_1();void rewrite_1();void delete_1();void seek_1();int a;system(cls);printf(t *欢迎使用小区用户管理系统* n);printf(t-()-n);printf(t- -n);printf(t- -n);printf(t- 1.浏览用户资料 -n);printf(t- 2.录入用户资料 -n);printf(t- 3
4、.更改用户资料 -n);printf(t- 4.删除用户资料 -n);printf(t- 5.查找用户资料 -n);printf(t- -n);printf(t- -n);printf(t-O(_)O-n);printf(t END n);printf(请输入所要选择内容的序号(1-3): bb);scanf(%d,&a);switch(a)case 1:scan_1();break;case 2:add_1();break;case 3:rewrite_1();break;case 4:delete_1();break;case 5:seek_1();break;default:exit(0
5、);void scan_1()FILE *fp; char ch; if(fp=fopen(e:data.txt,r+)=NULL) printf(cannot open the file!); exit(0); ch=fgetc(fp); while(ch!=EOF) putchar(ch); ch=fgetc(fp); fclose(fp); printf(n);void add_1()FILE *fp;if(fp=fopen(e:data.txt,a)=NULL)printf(文件不能打开/n);exit(0);elseint i;int num;printf(输入所要输入数据的数目=)
6、;scanf(%d,&num);for(i=2;inum+2;i+)printf(编号:);scanf(%d,&Pi.a);printf(姓名:);scanf(%s,Pi.ming);printf(项目:);scanf(%s,Pi.xiang);printf(已交:);scanf(%d,&Pi.b);printf(已欠:);scanf(%d,&Pi.c);fprintf(fp,%d %s %s %d %d,Pi.a,Pi.ming,Pi.xiang,Pi.b,Pi.c);fprintf(fp,n);fclose(fp);void savein_1() int i; FILE *fp;fp=fo
7、pen(e:data.txt,r);for(i=0;i3;i+)fscanf(fp,%d %s %s %d %d,&Pi.a,Pi.ming,Pi.xiang,&Pi.b,&Pi.c);fclose(fp);void rewrite_1()FILE *fp;void savein_1();if(fp=fopen(e:data.txt,a)=NULL)printf(文件不能打开/n);exit(0);elseint i=0,num;savein_1();printf(输入所要更改的编号 bb);scanf(%d,&num);while(Pi.a!=num)i+;printf(请输入所要的新标号n
8、);scanf(%d,&Pi-1.a);printf(请输入所要的姓名n);scanf(%s,Pi-1.ming);printf(请输入所要的收费项目n);scanf(%s,Pi-1.xiang);printf(请输入所欠的物业费n);scanf(%d,&Pi-1.b);printf(请输入已交的物业费n);scanf(%d,&Pi-1.c);fp=fopen(e:data.txt,w+);i=0;dofprintf(fp,%d %s %s %d %d,Pi.a,Pi.ming,Pi.xiang,Pi.b,Pi.c);i+;while(i=2);fclose(fp);void delete_1
9、()FILE *fp;void savein_1();int num,i=0;printf(请输入所要删除人的编号: bb);scanf(%d,&num);savein_1();while(Pi.a!=num)i+;for(i;i=5;i+)Pi.a=Pi+1.a;strcpy(Pi.ming,Pi+1.ming);strcpy(Pi.xiang,Pi+1.xiang);Pi.b=Pi+1.b;Pi.c=Pi+1.c;fp=fopen(e:data.txt,w);i=0;dofprintf(fp,%d %s %s %d %d,Pi.a,Pi.ming,Pi.xiang,Pi.b,Pi.c);i
10、+;while(i=5);fclose(fp);void seek_1()void savein_1();int num,i=0;printf(请输入所要查找的人的编号: bb);scanf(%d,&num);savein_1();while(i!=num)i+;printf(%d %s %s %d %d,Pi-1.a,Pi-1.ming,Pi-1.xiang,Pi-1.b,Pi-1.c);void menu_3()void scan_2();void add_2();void rewrite_1();void delete_2();int a;system(cls);printf(t *欢迎
11、使用物业收费管理系统* n);printf(t-(_?)-n);printf(t- -n);printf(t- -n);printf(t- 1.浏览小区收费项目 -n);printf(t- 2.增加小区收费数目 -n);printf(t- 3.更改小区收费项目 -n);printf(t- 4.删除小区收费项目 -n);printf(t- -n);printf(t- -n);printf(t-(o)-n);printf(t- END -n);printf(请输入所要选择内容的序号(1-3): bb);scanf(%d,&a);switch(a)case 1:scan_2();break;case
12、 2:add_2();break;case 3:rewrite_1();break;case 4:delete_2();break;default:exit(0);void scan_2()FILE *fp; char ch; if(fp=fopen(e:data.txt,r+)=NULL) printf(cannot open the file!); exit(0); ch=fgetc(fp); while(ch!=EOF) putchar(ch); ch=fgetc(fp); fclose(fp); void add_2()int i,num;FILE *fp;if(fp=fopen(e:
13、data.txt,a)=NULL)printf(文件不能打开/n);exit(0);elseprintf(输入所要输入数据的数目=);scanf(%d,&num);for(i=3;inum+3;i+)printf(编号:);scanf(%d,&Pi.a);printf(姓名:);scanf(%s,&Pi.ming);printf(项目:);scanf(%s,&Pi.xiang);printf(已交:);scanf(%d,&Pi.b);printf(已欠:);scanf(%d,&Pi.c);fprintf(fp,%d %s %s %d %d,Pi.a,Pi.ming,Pi.xiang,Pi.b,
14、Pi.c);fclose(fp);printf(n);/*void rewrite_2()FILE *fp;if(fp=fopen(e:data.txt,w)=NULL)printf(文件不能打开/n);exit(0);elseint i,num;printf(输入所要输入数据的数目=);scanf(%d,&num);for(i=3;inum+3;i+)printf(项目:);scanf(%s,&Pi.xiang);fprintf(fp,%s,Pi.xiang);fprintf(fp,n);fclose(fp); */void delete_2(int d)FILE *fp;void save
15、in_1();int num,i=0;printf(请输入所要删除人的编号: bb);scanf(%d,&num);savein_1();while(i!=num)i+;for(i=num;i+)Pi.a=Pi+1.a;strcpy(Pi.ming,Pi+1.ming);strcpy(Pi.xiang,Pi+1.xiang);Pi.b=Pi+1.b;Pi.b=Pi+1.b;fp=fopen(e:data.txt,a);doi=0;fprintf(fp,%d %s %s %d %d,Pi.a,Pi.ming,Pi.xiang,Pi.b,Pi.c);i+;while(i=5);fclose(fp);void biao_1()FILE *fp; char ch; if(fp=fopen(e:data.txt,r+)=NULL) printf(cannot open the file!); exit(0); ch=fgetc(fp); while(ch!=EOF) putchar(ch); ch=fgetc(fp); fclose(fp); printf(n); 专心-专注-专业
限制150内