c语言物业管理系统_第1页
c语言物业管理系统_第2页
c语言物业管理系统_第3页
c语言物业管理系统_第4页
c语言物业管理系统_第5页
已阅读5页,还剩25页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、#include<stdio.h>#include<stdlib.h>#include<string.h>#ifdef _GNUC_#include<unistd.h>#include<curses.h>#define clear clear#define Sleep(x) usleep(x#000)#endif#ifdef _MSC_VER#include<windows.h>#include<conio.h>#define clear system("cls")#endif#define

2、 TRUE 1#define FAUSE 0typedef struct perchar name20;int sex;char IDcard19;char phone12;int build_num;int unit_num;int house_num;float area;float area_price;float charge;char remarks200;struct per *next;PERSON;void zhuce ();int login ();PERSON *Getdata (FILE *fp); void add_person ();void del (PERSON

3、*L);void change (PERSON *L);void sort_All (PERSON *L);void pay (PERSON *L);void sort_B_num (PERSON *L);void menu_1 ();void menu_2 ();int main ()int check,a;printf("t* Welcome !*");printf("ntt1.注册");printf("ntt2.登录");printf("ntt0.退出");printf("nt-请输入-: &quo

4、t;);scanf("%d",&a);clear;switch(a)case 0:printf("tt-感谢使用本系统!-");Sleep(2000);exit(0);case 1:zhuce();clear;check = login();while (check = FAUSE)printf("n用户名或密码错误。");Sleep(2000);clear;check = login();clear;menu_1();break;case 2:check = login();while (check = FAUSE)prin

5、tf ("n用户名或密码错误。");Sleep(2000);clear;check = login();clear;menu_1();break;return 0;void menu_1 ()FILE *fp;int a;PERSON *head = NULL;printf("tt*欢迎使用*");printf("ntt1.用户添加");printf("ntt2.用户修改");printf("ntt3.用户删除");printf("ntt4.用户费用信息查看");printf

6、("ntt5.用户缴费");printf("ntt0.退出");printf("nt-请输入-: ");scanf("%d",&a);clear;switch(a)case 0:printf("-感谢使用!-");Sleep(3000);exit(0);case 1:add_person();menu_1();break;case 2:fp = fopen("data.dat","r");head = Getdata(fp);printf(&quo

7、t;%s",head->name);if (head = NULL)printf("没有任何数据");Sleep(3000);exit(1);elsechange(head);menu_1();break;case 3:if(fp = fopen("data.dat","rb") = NULL)printf("没有任何数据");exit(1);elsehead = Getdata(fp);del(head);menu_1();break;case 4:menu_2();break;case 5:fp

8、 = fopen("data.dat","rb");head = Getdata(fp);if (head = NULL)printf("没有任何数据");Sleep(3000);exit(1);elsepay(head);menu_1();break;void menu_2 ()FILE *fp;int a;PERSON *head = NULL;printf("tt*用户信息查看*");printf("ntt1.按楼号查看用户物业费情况");printf("ntt2.按费用信息查看

9、用户物业费情况");printf("ntt0.退出");printf("nt-请输入-:");scanf("%d",&a);clear;switch(a)case 0:printf("感谢使用");Sleep(3000);exit(0);case 1:fp = fopen("data.dat","rb");head = Getdata(fp);if (head = NULL)printf("没有任何数据");Sleep(3000);exi

10、t(1);elsesort_B_num(head);menu_2();break;case 2:fp = fopen("data.dat","rb"); head = Getdata(fp); if (head = NULL) printf("没有任何数据"); Sleep(3000); exit(1); elseprintf("tt-所有用户物业费情况-n");sort_All(head);menu_2();break;void zhuce ()FILE *fp;char ad50,key050,key150;c

11、har ch;int i,j;printf("tt*用户注册*");printf("nt-请输入用户名: ");scanf("%s",ad);while (1)i = 0;j = 0;printf("nt-请输入密码: ");/initscr();/noecho();while (ch = getch() != 'r')if (ch = 8)printf("b ");putchar('b');if (i > 0)i-;elseputchar('*&#

12、39;);/fflush(stdout);key0i+ = ch;/endwin();key0i = '0'printf("nt-请再次输入密码: ");/initscr();/noecho();while (ch = getch() != 'r' ) if (ch = 8) printf("b "); putchar('b'); if (j > 0) j-; else putchar('*'); key1j+ = ch; /endwin();key1j = '0'if

13、 (strcmp(key0,key1) != 0)clear;printf("%d",strcmp(key0,key1);printf("t-两次输入密码不符,请重新输入-");Sleep(2000);clear;elseprintf("n-用户 %s 注册成功!-",ad);Sleep(3000);fp = fopen("admin.txt","a");fprintf(fp,"%sn",ad);fclose(fp);fp = fopen("key.txt"

14、;,"a");fprintf(fp,"%sn",key0);fclose(fp);break;int login ()FILE *fp1,*fp2;char ad50,key50;char ch_150,ch_250,ch_0;int i = 0,check = 0;printf("tt*用户登录*");printf("ntt-用户名- ");scanf("%s",ad);printf("ntt-密码- ");/initscr();while (ch_0 = getch()

15、!= 'r')if (ch_0 = 8)printf("b ");putchar('b');if (i > 0)i-;elseputchar('*');keyi+ = ch_0;keyi = '0'/endwin();fp1 = fopen("admin.txt","r");fp2 = fopen("key.txt","r");while (!feof(fp1)fscanf(fp1,"%s",ch_1);f

16、scanf(fp2,"%s",ch_2);/printf("%s",ch_1);/printf("%s",ch_2);if (strcmp(ad,ch_1) = 0)if (strcmp(key,ch_2) = 0)check = TRUE;break;fclose(fp1);fclose(fp2);return check;PERSON *Getdata (FILE *fp)PERSON *head = NULL;PERSON *p1,*p2;p1 = (PERSON*)malloc(sizeof(struct per);while

17、 (fread(p1,sizeof(struct per),1,fp) = 1)/printf("%s",p1->name);if (head = NULL)head = p2 = p1;elsep2 -> next = p1;p2 = p1;p1 = p1 -> next;p1 = (PERSON*)malloc(sizeof(struct per);p2 -> next = NULL;free(p1);return head;void save (PERSON *head)FILE *fp;PERSON *p;fp = fopen("d

18、ata.dat","wb+");p = head;while (p != NULL)fwrite(p,sizeof(struct per),1,fp);p = p -> next;fclose(fp);void add_person ()PERSON *p1,*p2;PERSON *head = NULL;int n;printf("ntt*用户添加*");while (1)p1 = (PERSON*)malloc(sizeof(struct per);printf("nn请输入用户信息: 姓名 性别(0.女性;1.男性) 身份

19、证 联系方式 楼号 单元号 房号 平米数 每平米价格 备注nn");scanf("%s",(*p1).name);scanf("%d",&(*p1).sex);scanf("%s",(*p1).IDcard);scanf("%s",(*p1).phone);scanf("%d",&(*p1).build_num);scanf("%d",&(*p1).unit_num);scanf("%d",&(*p1).house

20、_num);scanf("%f",&(*p1).area);scanf("%f",&(*p1).area_price);scanf("%s",(*p1).remarks);(*p1).charge = (*p1).area * (*p1).area_price * (-1);if (head = NULL)head = p2 = p1;elsep2 ->next = p1;p2 = p1;printf("nt-用户添加成功!-");printf("n是否继续添加(1.是;0.否)&q

21、uot;);scanf("%d",&n);if (n = 0)break;p1 = p1 -> next;p2 -> next = NULL;save(head);void del (PERSON *L)PERSON *head,*p1,*p2;PERSON *p;char name20,ID19;int k = 0;int n;p = (PERSON*)malloc(sizeof(struct per);p -> next = head = L;while (1)p1 = p;printf("请输入所要删除的用户姓名及身份证号n- &q

22、uot;);scanf("%s %s",name,ID);while (p1 -> next != NULL)if (strcmp(name,p1->next->name) = 0 && strcmp(ID,p1->next->IDcard) = 0)p2 = p1 -> next;p1 -> next = p2 -> next;free(p2);k = 1;break;p1 = p1 -> next;head = p -> next;if (k = 0)printf("nt-没有相关用户

23、!-");elseprintf("nt删除用户- %s -成功!",name);printf("n是否继续删除(1.是;0否)");scanf("%d",&n);if (n = 0)break;save(head);void change (PERSON *L)char name20,ID19;PERSON *p;int n,k = 0;while (1)p = L;printf("-请输入所需修改用户的姓名及身份证-n-");scanf("%s",name);scanf(&q

24、uot;%s",ID);while (p -> next != NULL)if (strcmp(p -> name,name) = 0 && strcmp(p -> IDcard,ID) = 0)k = 1;break;p = p -> next;if (k = 0)printf("没有查找到该用户,是否重新输入(1.是;0.否)n-");scanf("%d",&n);if (n != 1)break;elseclear;printf("t-请输入用户 - %s - 修改后信息-&quo

25、t;,p -> name);printf("姓名 性别 身份证 联系方式 楼号 单元号 房号 平米数 每平米价格 备注");scanf("%s",(*p).name); scanf("%d",&(*p).sex); scanf("%s",(*p).IDcard); scanf("%s",(*p).phone); scanf("%d",&(*p).build_num); scanf("%d",&(*p).unit_num); s

26、canf("%d",&(*p).house_num); scanf("%f",&(*p).area); scanf("%f",&(*p).area_price); scanf("%s",(*p).remarks); (*p).charge = (*p).area * (*p).area_price;printf("修改用户成功n是否继续修改(1.是;0.否)");scanf("%d",&n);if (n != 1)break;save(L);v

27、oid pay (PERSON *L)char name20,ID19;PERSON *head,*p;int n,k = 0;float money;head = L;while (1)printf("-请输入所需缴费的用户及身份证-n-");scanf("%s %s",name,ID);p = head;while (p -> next != NULL)if (strcmp(p -> name,name) = 0 && strcmp(p -> IDcard,ID) = 0) k = 1; break; p = p -

28、> next;if (k = 0) printf("没有查找到该用户,是否重新输入(1.是;0.否)n-"); scanf("%d",&n); if (n != 1) break; elseprintf("请输入缴费金额:n-");scanf("%f",&money);p -> charge += money;printf("是否继续缴费(1.是;0.否)");scanf("%d",&n);if (n != 1)break;save(hea

29、d);void sort_All (PERSON *L)PERSON *p;PERSON s20,a;int n = 0;int i,j;p = L;while (p -> next != NULL)strcpy(,p -> name);sn.sex = p -> sex;strcpy(sn.IDcard,p -> IDcard);strcpy(sn.phone,p -> phone);sn.build_num = p -> build_num;sn.unit_num = p -> unit_num;sn.house_num = p -&

30、gt; house_num;sn.area = p -> area;sn.area_price = p -> area_price;sn.charge = p -> charge;strcpy(sn.remarks,p -> remarks);n+;p = p -> next;for (i = 0; i < n; i+)for (j = i+1; j < n; j+)if (si.charge > sj.charge)strcpy(,sj. name); a.sex = sj. sex; strcpy(a.IDcard,sj. IDc

31、ard); strcpy(a.phone,sj.phone); a.build_num = sj.build_num; a.unit_num = sj. unit_num; a.house_num = sj. house_num; a.area = sj. area; a.area_price = sj.area_price; a.charge = sj. charge; strcpy(a.remarks,sj.remarks); strcpy(,); sn.sex = si.sex; strcpy(sj.IDcard,si.IDcard); strcpy(sj.p

32、hone,si.phone); sj.build_num = si.build_num; sj.unit_num = si.unit_num; sj.house_num = si.house_num; sj.area = si.area; sj.area_price = si.area_price; sj.charge = si.charge; strcpy(sn.remarks,si.remarks);strcpy(,); si.sex = a.sex; strcpy(si.IDcard,a.IDcard); strcpy(si.phone,a.phone); si

33、.build_num = a.build_num; si.unit_num = a.unit_num; si.house_num = a.house_num; si.area = a.area; si.area_price = a.area_price; si.charge = a.charge; strcpy(sn.remarks,a.remarks);printf("姓名 性别 身份证 联系电话 楼号 单元号 房号 平米数 每平米价格 费用情况 备注");for (i = 0; i < n; i+)printf("%s %d %s %s %d %d %d

34、 %.2f %.2f %.2f %sn",,si.sex,si.IDcard,si.phone,si.build_num,si.unit_num,si.area,si.area_price,si.charge,si.remarks);void sort_B_num (PERSON *L)PERSON a10,b10;PERSON *p;int i=0,j=0,n;p = L;while (p -> next != NULL)if (p -> build_num = 1 && p -> charge < 0)strcpy(,p -> name); ai.sex = p -> sex; strcpy(ai.IDcard,p -> IDcard); strcpy(ai.phone,p -> phone); ai.build_num = p -> build_num; ai.unit_num = p -> unit_num

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论