c語言物業(yè)管理系統(tǒng)_第1頁
c語言物業(yè)管理系統(tǒng)_第2頁
c語言物業(yè)管理系統(tǒng)_第3頁
c語言物業(yè)管理系統(tǒng)_第4頁
c語言物業(yè)管理系統(tǒng)_第5頁
已閱讀5頁,還剩15頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認(rèn)領(lǐng)

文檔簡介

1、#in clude#in clude#in clude#ifdef _GNUC_#in clude#in clude#defi ne clear clear#defi ne Sleep(x) usleep(x#OOO)#en dif#ifdef _MSC_VER#in clude#in clude#defi ne clear system(cls)#en dif#defi ne TRUE 1#defi ne FAUSE 0typedef struct perchar n ame20;int sex;char IDcard19;char pho ne12;int build_ num;int u

2、nit_num;int house_ num;float area;float area_price;float charge;char remarks200; struct per *n ext;PERSON;void zhuce ();in t logi n ();PERSON *Getdata (FILE *fp); void add_pers on ();void del (PERSON *L);void change (PERSON *L);void sort_All (PERSON *L);void pay (PERSON *L);void sort_B_num (PERSON *

3、L);void menu_1 (); void menu_2 ();int mai n ()int check,a;prin tf(t* * Welcome !*);printf(ntt1. 注冊); printf(ntt2.登錄); printf(nttO.退出);printf(nt-請輸入-:);scan f(%d,&a);clear;switch(a)case 0: printf(tt-感謝使用本系統(tǒng)!-);Sleep(2000);exit(0);case 1:zhuce();clear;check = logi n();while (check = FAUSE)printf(n用戶名或

4、密碼錯誤。); Sleep(2000);clear;check = logi n();clear;menu _1();break;case 2: check = logi n();while (check = FAUSE)printf (n用戶名或密碼錯誤。);Sleep(2000); clear; check = logi n();clear;menu _1(); break; return 0;void menu_1 ()FILE *fp;int a;PERSON *head = NULL;*歡迎使用*“);printf(ntt1.用戶添加);printf(ntt2.用戶修改);print

5、f(ntt3.用戶刪除);prin tf(ntt4.用戶費用信息查看);printf(ntt5.用戶繳費);printf(nttO.退出);printf(nt-請輸入-:);scan f(%d,&a);clear; switch(a)case 0: printf(-感謝使用!-);Sleep(3000); exit(0);case 1: add_pers on(); menu _1(); break;case 2:soogd 2S嚴(yán)粵懸叵史w怒=)tu_d(HnN hh peII)七MdMelepooH pe i|M=q=-=rop.erop=)ued04 H eIn Seo宀三 eaiqoC

6、XIInu tu& SEO宀三 eaiq宀oLInu tuMpeeloopMdMeropooH pe i| soMMX 嚴(yán)粵懸叵史w怒=)tu_d (HnN hh (=q=-=rop.erop=)ued04 HeMC Seo宀三 eaiq 宀oLInu tuee llo6uelp so宀MMXsoogd 2S 嚴(yán)粵懸叵史w怒=)tu_d(HnN hh peII)七lueuApe 5s%=)tu_d MdMelepooH pe i|M=-=rop.erop=)ued04 H eexit(1);elsepay(head); menu _1();break; void menu_2 ()FILE *

7、fp;int a;PERSON *head = NULL;*用戶信息查看*);prin tf(ntt1.按樓號查看用戶物業(yè)費情況”);prin tf(ntt2.按費用信息查看用戶物業(yè)費情況);printf(nttO.退出);printf(nt-請輸入-:);scan f(%d,&a);clear;switch(a)case 0: printf(感謝使用);Sleep(3000);exit(0);case 1:fp = fope n(data.dat,rb);head = Getdata(fp);if (head = NULL)printf(沒有任何數(shù)據(jù)); Sleep(3000);exit(1

8、);elsesort_B_ nu m(head);menu _2();break;case 2:fp = fope n(data.dat,rb);head = Getdata(fp);if (head = NULL)printf(沒有任何數(shù)據(jù)); Sleep(3000);exit(1);elseprintf(tt-所有用戶物業(yè)費情況-n); sort_All(head);menu _2();break; void zhuce ()FILE *fp;char ad50,key050,key150;char ch;int i,j;*用戶注冊);printf(nt-請輸入用戶名:”);scan f(

9、%s,ad);while (1)i = 0;j = 0;printf(nt-請輸入密碼:);/in itscr();/no echo();while (ch = getch() != r)if (ch = 8)prin tf(b ); putchar(b);if (i 0)i-;elseputchar(*);/fflush(stdout);keyOi+ = ch;/endwin();keyOi = 0;printf(nt-請再次輸入密碼:”);/in itscr();/no echo();while (ch = getch() != r)if (ch = 8)prin tf(b ); putc

10、har(b);if (j 0)j-; elseputchar(*); key1j+ = ch;/endwin();key1j = 0;if (strcmp(key0,key1) != 0)clear;prin tf(%d,strcmp(key0,key1);printf(t-兩次輸入密碼不符,請重新輸入-);Sleep(2000);clear;elseprintf(n-用戶 s 注冊成功!-,ad);Sleep(3000);fp = fopen (adm in. txt,a);fprin tf(fp,%sn ”,ad);fclose(fp);fp = fope n(key.txt,a);fpr

11、in tf(fp,%sn,keyO);fclose(fp);break;in t logi n ()FILE *fp1,*fp2;char ad50,key50;char ch_150,ch_250,ch_0; int i = 0,check = 0;prin tf(tt* *printf(ntt- 用戶名-); scan f(%s,ad);printf(ntt- 密碼-);/ini tscr();while (ch_0 = getch() != r) if (ch_0 = 8)prin tf(b ); putchar(b);if (i 0)i-;用戶登錄*“); elseputchar(*)

12、; keyi+ = ch_0;keyi = 0:/ endwin();fp1 = fope n( admi n. txt,r);fp2 = fope n(key.txt,廣);while (!feof(fp1)fscan f(fp1,%s,ch_1);fscan f(fp2,%s,ch_2);/prin tf(%s,ch_1);/prin tf(%s,ch_2);if (strcmp(ad,ch_1) = 0)if (strcmp(key,ch_2) = 0) check = TRUE; break;fclose(fp1);fclose(fp2);retur n check;PERSON *G

13、etdata (FILE *fp)PERSON *head = NULL;PERSON *p1,*p2;p1 = (PERSON*)malloc(sizeof(struct per); while (fread(p1,sizeof(struct per),1,fp) = 1) /prin tf(%s,p1- name);if (head = NULL)head = p2 = p1;elsep2 - next = p1;p2 = p1;pl = pl - n ext;pl = (PERSON*)malloc(sizeof(struct per);p2 - next = NULL;free(p1)

14、;retur n head;void save (PERSON *head)FILE *fp;PERSON *p;fp = fope n(data.dat,wb+);p = head;while (p != NULL)fwrite(p,sizeof(struct per),1,fp);p = p - n ext;fclose(fp); void add_pers on ()PERSON *p1,*p2;PERSON *head = NULL;int n;prin tf(ntt*用戶添加*);while (1)p1 = (PERSON*)malloc(sizeof(struct per);樓號p

15、rintf(nn請輸入用戶信息:姓名 性別(0.女性;1.男性)身份證 聯(lián)系方式單元號房號平米數(shù)每平米價格備注nn ”);scan f(%s,(*p1). name);scan f(%d, &(*p1).sex);scan f(%s,(*p1).IDcard);scan f(%s,(*p1).pho ne);scan f(%d, &(*p1).build_ nu m);scan f(%d,& (*p1).u nit_n um);scan f(%d, &(*p1).house_ nu m);scan f(%f,&(*p1).area);scan f(%f,&(*p1).area_price);s

16、can f(%s,(*p1).remarks);(*p1).charge = (*p1).area * (*p1).area_price * (-1);if (head = NULL)head = p2 = p1;elsep2 _n ext = p1;p2 = p1;printf(nt-用戶添加成功!-);printf(n 是否繼續(xù)添加(1.是;0.否);scan f(%d, &n);if (n = 0)break;p1 = p1 - n ext;p2 - next = NULL;save(head);void del (PERSON *L)PERSON *head,*p1,*p2;PERSO

17、N *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-);scan f(%s %s, name,ID);while (p1 - next != NULL)if (strcmp( name,p1- n ext- n ame) = 0 & strcmp(ID,p1- n ext-IDcard) = 0) p2 = p1 - n ext;p1 - n ext = p2 - n e

18、xt;free(p2);k = 1;break;pl = pl - n ext;head = p - n ext;if (k = 0)printf(nt-沒有相關(guān)用戶!-);else printf(nt刪除用戶-%s 戒功! ,name);printf(n是否繼續(xù)刪除(1是;0否);scan f(%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-);sca nf(%s,

19、 name);scan f(%s,ID);while (p - next != NULL)if (strcmp(p - n ame ,n ame) = 0 & strcmp(p - IDcard,ID) = 0) k = 1;break;p = p - n ext;if (k = 0)printf(沒有查找到該用戶,是否重新輸入(1.是;0.否)n-);scan f(%d,&n);if (n != 1)break;elseclear;printf(t-請輸入用戶 -%s -修改后信息-,p - name);每平米printf(”姓名性別身份證聯(lián)系方式樓號單元號房號平米數(shù) 價格 備注”);sca

20、n f(%s,(*p). name);scan f(%d,&(*p).sex);scan f(%s,(*p).IDcard);scan f(%s,(*p).pho ne);scan f(%d,&(*p).build_ nu m);scan f(%d,&(*p).u nit_num);scan f(%d,&(*p).house_ num);scan f(%f, &(*p).area);scan f(%f, &(*p).area_price);scan f(%s,(*p).remarks);(*p).charge = (*p).area * (*p).area_price;printf(修改用戶成

21、功n是否繼續(xù)修改(1.是;0.否);scan f(%d,&n);if (n != 1)break;save(L);void pay (PERSON *L)char name20,ID19;PERSON *head,*p;int n ,k = 0;float mon ey;head = L;while (1)printf(-請輸入所需繳費的用戶及身份證-n-);scan f(%s %s, name,ID);p = head;while (p - next != NULL)if (strcmp(p - n ame ,n ame) = 0 & strcmp(p - IDcard,ID) = 0)k

22、= 1;break;p = p - n ext;if (k = 0)(1.是 ;0.否)n-);printf(”沒有查找到該用戶,是否重新輸入 scan f(%d,&n);if (n != 1)break;elseprintf(請輸入繳費金額:n-);scan f(%f, &mo ney);p - charge += mon ey; printf(是否繼續(xù)繳費(1.是;0否);scan f(%d,&n);if (n != 1)break;save(head);void sort_AII (PERSON *L)PERSON *p;PERSON s20,a;int n = 0;int i,j;p

23、= L;while (p - next != NULL)strcpy(s n. name,p - n ame);sn .sex = p - sex;strcpy(s n.l Dcard,p - IDcard);strcpy(s n.ph on e,p - phon e);sn .build_ num = p - build_ num;sn .u nit_num = p - unit_num;sn .house_ num = p - house_ num;sn .area = p - area;sn .area_price = p - area_price;sn charge = p - cha

24、rge;strcpy(s n.remarks,p - remarks);n+;p = p - n ext;for (i = 0; i n; i+)for (j = i+1; j sj.charge)strcpy(a .n ame,sj. n ame);a.sex = sj. sex; strcpy(a .I Dcard,sj. IDcard); strcpy(a.ph on e,sj.ph on e); a.build_ num = sj.build_ num; a.unit_num = sj. unit_num; a.house_ num = sj. house_ num; a.area =

25、 sj. area;a.area_price = sj.area_price; a.charge = sj. charge; strcpy(a.remarks,sj.remarks);strcpy(sj. name,si. name);sn .sex = si.sex; strcpy(sj.IDcard,si.IDcard); strcpy(sj.ph on e,si.ph on e); sj.build_ num = si.build_ num; sj.u nit_num = si.u nit_num; sj.house_ num = si.house_ num; sj.area = si.

26、area; sj.area_price = si.area_price; sj.charge = si.charge;strcpy(s n .remarks,si.remarks);strcpy(si. name,a .n ame); si.sex = a.sex; strcpy(si.IDcard,a .I Dcard); strcpy(si.ph on e,a.ph on e); si.build_ num = a.build_ num; si.u nit_num = a.unit_num; si.house_ num = a.house_ num;si.area = a.area;si.

27、area_price = a.area_price;si.charge = a.charge;strcpy(s n.remarks,a.remarks);printf(姓名性別平米價格費用情況身份證備注);聯(lián)系電話樓號單元號房號平米數(shù)每for (i = 0; i next != NULL)if (p - build_ num = 1 & p - charge n ame);ai.sex = p - sex;strcpy(ai.IDcard,p - IDcard);strcpy(ai.ph on e,p - phon e);ai.build_ num = p - build_ num;ai.u nit_num = p - unit_num;ai.house_ num = p - house_ num;ai.area = p - area;a

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論