售楼系统源代码_第1页
售楼系统源代码_第2页
售楼系统源代码_第3页
已阅读5页,还剩5页未读, 继续免费阅读

下载本文档

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

kok电子竞技:文档简介

1、#include"conio.h"#include"stdio.h"#include"stdlib.h"#include"string.h"#defineMAX100#defineN3structchaoxiang_type/*日期结构体类型*/intdanyu;intloucen;structloupans_typecharnum8;/*楼号*/charprice20;/*价格(/m2)*/charchaoxiang20;/*面向*/intarea;/*面积*/structchaoxiang_typeweizhi

2、;/*单元信息*/structchaoxiang_typekind;/*类型*/;用户信息结构体structuser_typecharusername15,password15;user;intm;intnumber;登录选择/*读取信息模块*/intread_file(structloupans_typeloupan)(FILE*fp;inti=0;if(fp=fopen("loupans.txt","rt")=NULL)(printf("n库存文件不存在,请创建!n");return0;while(!feof(fp)(fread(

3、&loupani,sizeof(structloupans_type),1,fp);if(loupani.num=0)break;elsei+;fclose(fp);returni;/*保存信息模块*/voidsave_file(structloupans_typeloupan,intsum)(FILE*fp;inti;if(fp=fopen("loupans.txt","wt")=NULL)(printf("读文件错误n");return;for(i=0;i<sum;i+)if(fwrite(&loupani,

4、sizeof(structloupans_type),1,fp)!=1)printf("写文件错误n");fclose(fp);/*登录菜单打印intprint1(void)(printf("n");printf("n");printf("tt*nn");printf("tt*欢迎登录楼盘销售管理系统!*nn");printf("tt*n");printf("n");printf("ttt*n");printf("ttt*t1

5、注册:t*n");printf("ttt*ttt*n");printf("ttt*t2登录:t*n");printf("ttt*ttt*n");printf("ttt*t3退出:t*n");printf("ttt*nn");printf("ttt请按序号输入你的选择:n");printf("nttt");scanf("%d”,&m);return(m);/*登录模块*/*登录程序intlogin(void)intflag=1,s

6、tr1,str2,time=0;inti,n=0;charch=0;FILE*fp;structuser_typeuser1;system("cls");printf("nnnn");while(flag)system("cls");printf("nnnn");switch(m)case1:printf("ttt!注册小提示:nn");printf("ttt用户名和密码不得超过15个字符!nn");printf("nn");fp=fopen("

7、f:/password.txt”,"wt”);if(fp=NULL)(printf("ttt对不起,此文件打不开:n");getch();exit(1);printf("ttt请输入你的用户名:nnttt");fflush(stdin);gets(userl.username);fflush(stdin);printf("nttt请你输入密码:nnttt");ch=getch();i=0;while(ch!='r')(user1.passwordi=ch;printf("*");if(ch

8、=8)(printf("bbbb");i-;elsei+;ch=getch();fflush(stdin);user1.passwordi='0'fprintf(fp,"%sn%sn",user1.username,user1.password);fclose(fp);flag=0,n=1;printf("nnnn");printf("ttt注册成功!nttt");getch();system("cls");break;case2:未注册直接登录fp=fopen("f:

9、/password.txt","rt");if(fp=NULL)(printf("ttt对不起,此文件打不开:n");getch();exit(1);fscanf(fp,"%sn%sn”,user.username,user.password);fclose(fp);printf("ttt请输入你的用户名:nnttt");fflush(stdin);gets(user1.username);fflush(stdin);printf("ttt请你输入密码:nnttt");ch=getch();i=

10、0;while(ch!='r')user1.passwordi=ch;printf("*");if(ch=8)printf("bbbb");i-;elsei+;ch=getch();fflush(stdin);user1.passwordi=0;str1=strcmp(user1.username,user.username);str2=strcmp(user1.password,user.password);if(str1=0&&str2=0)system("cls");printf("nn

11、nn");printf("nnnn");printf("ttt成功登录!n");getch();return(1);elseprintf("nnnnttt登录失败,请重新登录!nttt");getch();time+;if(time=3)/登录次数超过三次自动退出printf("nnnnttt你超过登录次数,对不起!");getch();break;case3:exit(1);break;print1();flag=1;if(n)(system("cls");printf("

12、nnnnn");switch(m)(case1:printf("ttt你已经注册,请你登录!n");break;case2:注册后登录while(flag)(fp=fopen("f:/password.txt","rt");if(fp=NULL)(printf("ttt对不起,此文件打不开:n");getch();exit(1);fscanf(fp,"%sn%sn”,user.username,user.password);fclose(fp);printf("ttt请输入你的用户名:

13、nnnttt");fflush(stdin);gets(user1.username);fflush(stdin);printf("nnnttt请你输入密码:nnnttt");ch=getch();for(i=0;ch!='r'i+)(user1.passwordi=ch;printf("*");学习文档仅供参考if(ch=8)printf("bbbb");ch=getch();fflush(stdin);user1.passwordi='0'判断密码是否正确str1=strcmp(user1

14、.username,user.username);str2=strcmp(user1.password,user.password);if(str1=0&&str2=0)return(1);elseprintf("ttt登录失败!n");getch();flag=0;break;case3:exit(1);return(0);/*输入模块*/intinput(structloupans_typeloupan)inti=0;system("cls");printf("nnnn");printf("nt请输入要录

15、入的楼盘的个数(最多%d个):”,MAX);scanf("%d”,&number);printf("nnt录入楼盘信息(最多录入%d个)n",number);printf("n");while(i<number)printf("ntt第%d个楼盘",i+1);printf(nnttt楼盘楼号:000");scanf("%s”,loupani.num);if(loupani.num=0)break;printf("nttt价格(/m2):");scanf("%s”

16、,loupani.price);printf("nttt面向:”);scanf("%s”,loupani.chaoxiang);printf("nttt面积(单位:m2):");scanf("%d”,&loupani.area);printf("nttt楼盘单元信息(单元-层):");scanf("%d-%d”,&loupani.weizhi.danyu,&loupani.weizhi.loucen);printf("nttt楼盘类型(厅-室):");scanf(&quo

17、t;%d-%d”,&loupani.kind.danyu,&loupani.kind.loucen);i+;printf("nttt%d个楼盘信息录入完毕!n",i);getchar();printf("nttt按回车键返回主菜单!");getchar();returni;/*输出模块*/voidoutput(structloupans_typeloupan,intsum)FILE*fp;inti=0;system("cls");printf("nnn");fp=fopen("loupan

18、s.txt","rt");printf("nttt-楼盘信息表-nn");printf("楼盘楼号-单元信息(单元-层)-类型(厅-室)-面积(单位:m2)-面向-价格(/m2)n");printf("n");dofread(&loupani,sizeof(structloupans_type),1,fp);if(loupani.num!=0)printf(“%6s%10d-%2d%10d-%2dt%4dm2%8s%3sn”,loupani.num,loupani.weizhi.danyu,lou

19、pani.weizhi.loucen,loupani.kind.danyu,loupani.kind.loucen,loupani.area,loupani.chaoxiang,loupani.price);printf("n");i+;while(i<sum);getchar();printf(ttt按回车键返回主菜单");getchar();fclose(fp);/*修改模块*/voidmodify(structloupans_typeloupan,intsum)inti=0,choice,flag;charmodify_num8;dosystem(&q

20、uot;cls");printf("nnnn");printf("n输入要修改的楼盘的楼号:");scanf("%s",modify_num);for(i=0;i<sum;i+)if(!strcmp(loupani.num,modify_num)printf("nttt-楼盘信息-n");printf("楼盘楼号-单元信息(单元-层)-类型(厅-室)-面积(单位5)-面向-价格(/m2)n");printf("n");printf(“%6s%10d-%2d%1

21、0d-%2dt%4dm2%8s%3sn”,loupani.num,loupani.weizhi.danyu,loupani.weizhi.loucen,loupani.kind.danyu,loupani.kind.loucen,loupani.area,loupani.chaoxiang,loupani.price);printf("ttt1.楼盘楼号nnttt2.价格(/m2)nnttt3.面向nnttt4.面积(单位:nf)nnttt5.单元信息(单元-层)nnttt6.类型(厅-室)n");printf("请输入要修改项的楼号选择1-6:”);scanf(

22、"%d",&choice);switch(choice)case1:printf("nttt输入修改后的楼盘楼号:000:”);scanf("%s",loupani.num);break;case2:printf("nttt输入修改后的价格(/m2):”);scanf("%s",loupani.price);break;case3:printf("n输入修改后的面向:");scanf("%s”,loupani.chaoxiang);break;case4:printf(&quo

23、t;nttt输入修改后的面积(单位:m2):”);scanf("%d”,&loupani.area);break;case5:printf("n输入修改后的楼盘单元信息(单元-层):");scanf("%d-%d”,&loupani.weizhi.danyu,&loupani.weizhi.loucen);break;case6:printf("nttt输入修改后的楼盘类型(厅-室):”);scanf("%d-%d”,&loupani.kind.danyu,&loupani.kind.louce

24、n);break;printf(-nttt-楼盘信息-(修改后)n");printf(-楼盘楼号-单元信息(单元-层)-类型(厅-室)-面积(单位5)-面向-价格(/m2)n");printf("n");printf(“%6s%10d-%2d%10d-%2dt%4dm2%8s%3sn”,loupani.num,loupani.weizhi.danyu,loupani.weizhi.loucen,loupani.kind.danyu,loupani.kind.loucen,loupani.area,loupani.chaoxiang,loupani.pri

25、ce);getchar();break;if(i=sum)printf("nttt该楼盘不存在");getchar();save_file(loupan,sum);printf("nn继续修改吗?Y/N(选择N则返回主菜单)”);choice=getchar();if(choice='Y'|choice='y')flag=1;printf("nttt继续修改!n");elseflag=0;while(flag=1);printf("n");/*查询模块*/voidreserch(structl

26、oupans_typeloupan,intsum)inti=0,choice,flag,key=0;charreserch18,reserch28;do(system("cls");printf("nnnn");printf("n请选择查询方式1或2:nntt1.按楼号tt2.按价格(/m2)ntt");scanf("%d",&choice);switch(choice)(case1:printf("n请输入要查询的楼盘的楼号:");scanf("%s”,reserch1);f

27、or(i=0;i<sum;i+)if(!strcmp(loupani.num,reserch1)(printf("nttt-楼盘信息-n");printf("楼盘楼号-单元信息(单元-层)-类型(厅-室)-面积(单位:W)-面向-价格(/m2)n");printf("n");printf(“%6s%10d-%2d%10d-%2dt%4dm2%8s%3sn”,loupani.num,loupani.weizhi.danyu,loupani.weizhi.loucen,loupani.kind.danyu,loupani.kind.

28、loucen,loupani.area,loupani.chaoxiang,loupani.price);printf("n");getchar();break;break;case2:printf("nttt请输入要查询的楼盘的价格范围(/m2):nnn");printf(ttt请输入最低价格:nttt");scanf(%s",reserch1);printf(nnttt请输入最高价格:nttt");scanf("%s",reserch2);for(i=0;i<sum;i+)if(strcmp(l

29、oupani.price,reserch1)>0&&strcmp(loupani.price,reserch2)<0)(key=1;if(1=key)(printf("nttt-楼盘信息-n");printf(-楼盘楼号-单元信息(单元-层)-类型(厅-室)-面积(单位:W)-面向-价格(/m2)n");printf("n");for(i=0;i<sum;i+)if(strcmp(loupani.price,reserch1)>0&&strcmp(loupani.price,reserch

30、2)<0)(printf(“%6s%10d-%2d%10d-%2dt%4dm2%8s%3sn”,loupani.num,loupani.weizhi.danyu,loupani.weizhi.loucen,loupani.kind.danyu,loupani.kind.loucen,loupani.area,loupani.chaoxiang,loupani.price);printf("n");printf('nnttt价格范围:%6s%6s",reserch1,reserch2);getch();break;if(0=key)(printf(&q

31、uot;nttt该楼盘不存在");getchar();printf("nntt继续查询吗?Y/N(选择N则返回主菜单)”);choice=getchar();if(choice='Y'|choice='y')(flag=1;printf("nttt继续修改!n");getch();elseflag=0;while(flag=1);printf("n");/*排序模块*/voidsort(structloupans_typeloupan,intsum)(inti,j;structloupans_typet

32、;system("cls");printf("nnnn");for(i=0;i<sum-1;i+)for(j=i+1;j<sum;j+)(if(strcmp(loupani.num,loupanj.num)>0)(t=loupani;loupani=loupanj;loupanj=t;printf("nttt按楼号排序:nn");printf("nttt-楼盘信息表-nn");printf("楼盘楼号-单元信息(单元-层)-类型(厅-室)-面积(单位:m2)-面向-价格(/m2)n&qu

33、ot;);printf("n");for(i=0;i<sum;i+)(printf(“%6s%10d-%2d%10d-%2dt%4dm2%8s%3sn”,loupani.num,loupani.weizhi.danyu,loupani.weizhi.loucen,loupani.kind.danyu,loupani.kind.loucen,loupani.area,loupani.chaoxiang,loupani.price);printf("n");getchar();printf("nttt按回车键返回主菜单!");get

34、char();/*删除模块*/intdel(structloupans_typeloupan,intsum)(inti,j,k=0;chardel_num8;system("cls");printf("nnnn");printf("tt请输入需要删除的楼盘信息的楼号nn");scanf("%s”,del_num);for(i=0;i<sum;i+)if(!strcmp(loupani.num,del_num)for(j=i;j<sum-1;j+)loupanj=loupanj+1;elsek+;if(k=sum)

35、printf("ttt该楼盘不存在n");getchar();printf(ttt按回车键返回主菜单”);getchar();return(sum);elsesave_file(loupan,sum);printf("ttt删除成功:n");getchar();printf("nttt按回车键返回主菜单!");getchar();return(sum-1);/*添加模块*/voidadd(structloupans_typeloupan,int*sum)inti,flag;charchoice;system("cls&quo

36、t;);printf("nnnn");i=(*sum);doif(i<MAX)printf("tt请输入要添加的楼盘的信息:n");printf("nttt楼盘楼号:000:");scanf("%s”,loupani.num);if(loupani.num=0)break;printf("nttt价格(/m2):");scanf("%s”,loupani.price);printf("nttt面向:”);scanf("%s”,loupani.chaoxiang);pri

37、ntf("nttt面积(单位:nf):");scanf("%d”,&loupani.area);printf("nttt楼盘单元信息(单元-层):");scanf("%d-%d”,&loupani.weizhi.danyu,&loupani.weizhi.loucen);printf("nttt楼盘类型(厅-室):");scanf("%d-%d”,&loupani.kind.danyu,&loupani.kind.loucen);(*sum)+;i=(*sum);g

38、etchar();printf(-n成功添加一个楼盘的信息!n");getchar();printf("n是否继续添加?Y/N(选择N则返回主菜单)n");choice=getchar();if(choice='Y'|choice='y')flag=1;printf("n继续添加!n");elseflag=0;elseprintf("nttt返回主菜单n");getch();break;while(flag=1);voidmain()intchoice,sum;structloupans_ty

39、peloupanMAX;intflag;system("color71");print1();flag=login();if(flag)system("cls");printf("nnnn");printf("nnnttt:啬愕锹汲晒Γnn");printf("nnnttt您现在可以对系统信息进行处理了!n");printf(nnnttt”);getch();sum=read_file(loupan)-1;system("cls");printf("nnnn&q

40、uot;);if(sum=0)printf("nnnn");printf("ttt楼盘库存信息为空!nn");printf("ttt按回车键开始录入基本库存信息!nn");printf("t");getchar();sum=input(loupan);save_file(loupan,sum);dosystem("cls");printf("n*S欢迎使用S*n");printf("n*楼盘信息管理*n");printf(n");printf(t

41、printf("t*n");printf("t0n");printf("t重查输添排*n");*修*删退n");printf("t新询出加序改除出n");printf("t录楼楼楼楼楼楼系n");printf("t入盘盘盘盘盘盘统n");printf("t楼信信信信信信n");printf("t盘息息息息息息n");printf("t信n");printf("t息nnnn");print

42、f("请选择您要执行的操作0-7");scanf("%d”,&choice);switch(choice)(case1:sum=input(loupan);save_file(loupan,sum);break;case2:reserch(loupan,sum);break;case3:save_file(loupan,sum);output(loupan,sum);break;case4:add(loupan,&sum);save_file(loupan,sum);break;case5:sort(loupan,sum);break;case6:modify(loupan,sum);save_file(loupan,sum);break;case7:sum=del(loupan,sum);save_file(loupan,sum);break;case0:break;while(choice!=0);save_file(loupan,sum);

温馨提示

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

评论

0/150

提交评论