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

下载本文档

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

文档简介

1、西安郵電學院高级语言课程设计报告题 目:楼盘销售管理系统院系名称:电子工程学院专业名称:集成电路设计与集成系统级:电路1002班学生姓名:王宜亮学号(8位):051060433 / 19孙韩林指导教师: 设计起止时间:2011年06月22日2011年07月01日#i ncludeco nio.h #in cludestdio.h #i ncludestdlib.h #i ncludestri ng.h#defi ne MAX 100#defi ne N 3日期结构体类型*/struct chaoxia ng_type/* int danyu;int louce n;struct loupans

2、_typechar nu m8;char p rice20;char chaoxia ng20;int area;/*楼号*/* 价格(/ rf )*/*面向*/*面积*/struct chaoxia ng_type weizhi; struct chaoxia ng_type kind;/*单元信息*/*类型*/struct user_t ypechar user name15, p assword15;/用户信息结构体user;int nu mber;int m;/登录选择/*读取信息模块*/int read_file(struct loupans_type loupan ) FILE *

3、fp;int i=0;if(fp=fo pen( lou pan s.txt,rt)=NULL)prin tf(n库存文件不存在,请创建!n ”);return 0;while(!feof(fp) fread(&loupan i,sizeof(struct loupans_typ e),1,fp); if(loupan i. num=0)break;elsei+;fclose(fp); return i;/*保存信息模块*/void save_file(struct loupans_type loupan ,i nt sum) FILE *fp;int i;if(fp=fo pen (lou

4、pan s.txt,wt)=NULL) printf(读文件错误n);return;for(i=0;isum;i+)if(fwrite(&loupan i,sizeof(struct loupans_typ e),1,fp)!=1) printf(”写文件错误n);/*登录菜单打印fclose(fp);int prin t1(void)prin tf(n);prin tf(n);printf(tt*nn);prin tf(tt*欢迎登录楼盘销售管理系统!*宙宙”);prin tf(tt* n)prin tf(n);prin tf(n);prin tf(n);*n); 注册:t*n);print

5、f(ttt*printf(ttt*t 1prin tf(ttt*ttt*n);printf(ttt*t 2prin tf(ttt*ttt*n);printf(ttt*t 3printf(ttt*nn);printf(ttt请按序号输入你的选择:n); prin tf(nttt);scan f(%d,&m);登录:t*n);退出:t*n);5 / 19return(m);/*登录模块*/*登录程序in t logi n( void)int flag=1,str1,str2,time=0;int i,n=0;char ch=0;FILE *fp;struct user_t ype user1;sy

6、stem(cls);prin tf(nnnn);while(flag)system(cls);printf(”nnnn);switch(m)case 1:printf(ttt !注册小提示:nn);printf(ttt用户名和密码不得超过15个字符!nn);prin tf(nn);fp=fo pen (f:/password.txt,wt); if(fp=NULL)printf(”ttt 对不起,此文件打不开:n); getch();exit(1);printf(ttt 请输入你的用户名:nnttt);fflush(stdi n);gets(user1.user name);fflush(st

7、di n);printf(nttt 请你输入密码:nnttt);ch=getch();i=0;while(ch!=r)user1. passwordi=ch;prin tf(*);if(ch=8)prin tf(bb bb);i-;else i+;ch=getch();fflush(stdi n);user1. passwordi=0;fprin tf(fp,%sn%sn ”,user1.user name,user1. password); fclose(fp);flag=0,n=1;prin tf(nnnn);printf(ttt 注册成功!nttt);getch();system(cls

8、);break;/未注册直接登录case 2:fp=fo pen( f:/password.txt,rt);if(fp=NULL)printf(ttt对不起,此文件打不开:n);getch();exit(1);fsca nf(fp,%sn%sn ,user.user name,user. password); fclose(fp);printf(ttt 请输入你的用户名:nnttt); fflush(stdi n);gets(user1.user name);fflush(stdi n);printf(ttt 请你输入密码:nnttt);ch=getch();i=0;while(ch!=r)u

9、ser1. passwordi=ch;prin tf(*);if(ch=8)prin tf(bb bb);i-;else i+;ch=getch();fflush(stdi n);user1. passwordi=0;str1=strc mp( user1.user name,user.user name);str2=strc mp( user1. password,user. password); if(str1=0&str2=0)system(cls);prin tf(”nnnn);prin tf(nnnn);printf(ttt 成功登录!n); getch();return(1); e

10、lseprintf(nnnnttt 登录失败,请重新登录!nttt); getch(); time+;/登录次数超过三次自动退出if(time=3)printf(nnnnttt 你超过登录次数,对不起!); getch();exit(1); break;case 3:exit(1);break;prin t1();flag=1;if(n)system(cls);prin tf(nnnnn);switch(m)case 1:printf(ttt你已经注册,请你登录!n); break;/注册后登录case 2:while(flag)fp=fo pen (f:/password.txt,rt);i

11、f(fp=NULL)printf(”ttt对不起,此文件打不开:n); getch();exit(1);fsca nf(fp,%sn%sn ,user.user name,user. password); fclose(fp);printf(ttt 请输入你的用户名:nnnttt); fflush(stdi n);gets(user1.user name);fflush(stdi n);printf(nnnttt 请你输入密码:nnnttt); ch=getch();for(i=0;ch!=r;i+)user1. passwordi=ch;prin tf(*);7 / 19if(ch=8)pr

12、in tf(bb bb);ch=getch();fflush(stdi n);user1. passwordi=0;II 判断密码是否正确str1=strc mp( userl.user name,user.user name);str2=strc mp( userl. password,user. password);if(str1=O&str2=0)return(1);elseprintf(ttt 登录失败!n);getch();flag=O;break;case 3:exit(1); return(O);/*输入模块*/int inpu t(struct loupans_type lou

13、pan )int i=0;system(cls);prin tf(nnnn);printf(nt请输入要录入的楼盘的个数(最多%d个):,MAX);录入楼盘信息(最多录入d个)n”,number);n);scan f(%d,&n umber);prin tf(nntprintf(”while(i nu mber)20 / 19prin tf(ntt 第%d个楼盘”,i+1);printf( hnttt 楼盘楼号:(000)”);sca nf(%s,l oupan i. nu m);if(loupan i. num=0) break;printf(nttt 价格(/ rf ):);sca nf(

14、%s,l oupan i. price);printf(nttt 面向:”);sca nf(%s,l oupan i.chaoxia ng);printf(nttt 面积(单位:rf):);scan f(%d, &lou pan i.area);printf(nttt楼盘单元信息(单元-层):);sca nf(%d-%d, &loupan i.weizhi.da nyu,&loupan i.weizhi.louce n);printf(nttt 楼盘类型(厅-室):);scan f(%d-%d, &lou pan i.ki nd.da nyu, &lou pan i.ki nd.louce n

15、); i+;prin tf(nttt%d个楼盘信息录入完毕!n,i);getchar();printf(nttt按回车键返回主菜单!);getchar();return i;/*输出模块*/void out pu t(struct loupans_type loupan ,i nt sum)FILE *fp;int i=0;system(cls);prin tf(nnn);fp=fo pen (lou pan s.txt,rt);printf(nttt -楼盘信息表-nn);printf(楼盘楼号单元信息(单元-层)-类型(厅-室)-面积(单位:rf )-面向-价格(/ rf )n);prin

16、tf(”n);dofread(&loupan i,sizeof(struct loupans_typ e),1,fp);if(loupan i. num!=0)printf( “%6s%10d-%2d%10d-%2dt%4drf %8s%3sn”,loupani.num,loupani.weizhi.danyu,loupani.weizhi.louce n,loupan i.k in d.da ny u,lo upan i.k ind.loucen ,lo upan i.area,lo upan i.chaoxia n g,lo upan i. price);prin tf(i+;while(

17、isum);getcharO;printf( ttt按回车键返回主菜单” getchar();fclose(fp);/*修改模块*/ void modify(struct loupans_type loupan ,i nt sum) int i=0,choice,flag;char modify_ nu m8;dosystem(cls);printf(”nnnn);prin tf(n输入要修改的楼盘的楼号:);sca nf(%s,modify_ nu m);for(i=0;isum;i+)if(!strcm p(lo upan i. num, modify_ num)printf(nttt-楼

18、盘信息- n );printf(”楼盘楼号-单元信息(单元-层)-类型(厅-室)-面积(单位:rf )-面向-价 格(/ rf )n);printf(”n);printf( “%6s%10d-%2d%10d-%2dt%4drf %8s%3sn”,loupani.num,loupani.weizhi.danyu,loupani.weizhi.louce n,loupan i.k in d.da ny u,lo upan i.k ind.loucen ,lo upan i.area,lo upan i.chaoxia n g,lo upan i. price);printf(ttt1.楼盘楼号nn

19、ttt2.价格(/ rf )nnttt3.面向 nnttt4.面积(单位:rf)nnttt5.单元信息(单元-层)nnttt6.类型(厅-室)n);printf(”请输入要修改项的楼号(选择 1-6):);scan f(%d,&choice);switch(choice)case 1:printf(n ttt输入修改后的楼盘楼号:(000):);sca nf(%s,l oupan i. nu m); break;case 2:printf(n ttt输入修改后的价格(/ rf ):);sca nf(%s,l oupan i. price); break;case 3:prin tf(n输入修改

20、后的面向:);sca nf(%s,l oupan i.chaoxia ng); break;case 4:printf(n ttt输入修改后的面积(单位:怦):);sca nf(%d,&loupan i.area); break;case 5:printf(n输入修改后的楼盘单元信息(单元-层):);sca nf(%d-%d, &loupan i.weizhi.da nyu,&loupan i.weizhi.louce n); break;case 6:printf(n ttt输入修改后的楼盘类型(厅-室):);sca nf(%d-%d, &loupan i.k in d.da nyu,&lo

21、upan i.k in d.louce n); break;printf(nttt-楼盘信息-(修改后) n );printf(”楼盘楼号-单元信息(单元-层)-类型(厅-室)-面积(单位:rf )-面向-价 格(/ rf )n);printf(”n);printf( “%6s%10d-%2d%10d-%2dt%4drf %8s%3sn”,loupani.num,loupani.weizhi.danyu,loupani.weizhi.louce n,loupan i.k in d.da ny u,lo upan i.k ind.loucen ,lo upan i.area,lo upan i.

22、chaoxia n g,lo upan i. price);getchar();break;if(i=sum)printf(nttt 该楼盘不存在 ”);getchar();save_file(lo upan, sum);printf(nn继续修改吗? ( Y/N(选择N则返回主菜单)”);choice=getchar();if(choice=Y|choice=y) flag=1;printf(n ttt 继续修改! n);else flag=0;while(flag=1);prin tf(n);/*查询模块*/ void reserch(struct Io upans_type loupan

23、 ,i nt sum) int i=0,choice,flag,key=0;char reserch18,reserch28;do请选择查询方式(1或2) : nntt1.按楼号tt2.按价格(/system(cls); printf(”nnnn);prin tf(nrf )ntt);scan f(%d, &choice);switch(choice)case 1:请输入要查询的楼盘的楼号:);prin tf(nscan f(%s,reserch1);for(i=0;isum;i+)if(!strcm p(lo upan i. num ,reserch1)printf(nttt-楼盘信息- n

24、 );printf(”楼盘楼号-单元信息(单元-层)-类型(厅-室)-面积(单位:rf )- 面向-价格(/ rf )n);nprintf(”);printf( “%6s%10d-%2d%10d-%2dt%4drf %8s%3sn ” ,loupani.num,loupani.weizhi.danyu,loupani.weizhi.louce n,loupan i.k in d.da ny u,lo upan i.k ind.loucen ,lo upan i.are a,lo upan i.chaoxia ng,lo upan i. price);nprintf(”);getchar();

25、break;break;case 2:printf(nttt请输入要查询的楼盘的价格范围(/ rf): nnn);printf( ttt 请输入最低价格:nttt ”);scanf( %s,reserch1);printf( nnttt 请输入最高价格:nttt ”);scan f(%s,reserch2);for(i=0;i 0& strcm p(lo upan i. pnce,reserch2)0) key=1;if(1=key)printf(nttt-楼盘信息- n );printf(”楼盘楼号-单元信息(单元-层)-类型(厅-室)-面积(单位:rf )- 面向-价格(/ rf )n);

26、nprintf(”);for(i=0;i 0& strcm p(lo upan i. pnce,reserch2)0)printf( %6s%10d-%2d%10d-%2dt%4drf %8s%3sn” ,loupani.num,loupani.weizhi.danyu,loupan i.weizhi.louce n,loupan i.k in d.da nyu,loupan i.k in d.louce n,loupan i.area,lo upan i.chaoxia ng,lo upan i. price);printf(”n);printf( nnttt 价格范围:6s%6s ”,re

27、serch1,reserch2);getch();break; if(O=key)printf(nttt 该楼盘不存在”);getcharO;printf(nntt继续查询吗? ( Y/N(选择N则返回主菜单)”); choice=getchar();if(choice=Y|choice=y)flag=1;printf(nttt 继续修改! n); getch();elseflag=0;while(flag=1); prin tf(n);/*排序模块*/void sort(struct loupans_type loupan ,i nt sum)int i,j;struct loupans_t

28、ype t;system(cls);prin tf(nnnn);for(i=0;isum-1;i+)for(j=i+1;j0)t=loupan i;loupan i=l oupan j;loupan j=t;按楼号排序:nn);printf(nttt-楼盘信息表-nn);printf(楼盘楼号单元信息(单元-层)-类型(厅-室)-面积(单位:rf )-面向-价格(/怦)n);printf(”n ”);for(i=0;isum;i+)printf(rf %8sprin tf(nttt%6s%10d-%2d%10d-%2dt%4d%3sn”,loupani.num,loupani.weizhi.d

29、anyu,loupani.weizhi.loucen,l oupan i.k in d.da ny u,lo upan i.k ind.loucen,loupan i.area,lo upan i.chaoxia ng,lo upan i. pri ce);printf(”getchar();printf(n ttt按回车键返回主菜单!);getchar();/*删除模块*/ int del(struct loupans_type loupan ,i nt sum) int i,j,k=0;char del_ nu m8;system(cls);prin tf(nnnn);printf(tt请

30、输入需要删除的楼盘信息的楼号nn);scan f(%s,del_ nu m);for(i=0;isum;i+)if(!strcm p(lo upan i. nu m,del_ num)for(j=i;jsum-1;j+)loupan j=l oupan j+1;elsek+; if(k=sum) printf(”ttt 该楼盘不存在 n); getcharO;printf( ttt按回车键返回主菜单”); getchar();return(sum); elsesave_file(lo upan, sum);printf(ttt 删除成功:n);getchar();printf(n ttt按回车

31、键返回主菜单!”);getchar();return(sum-1);/*添加模块*/void add(struct loupans_type loupan ,i nt *sum)int i,flag; char choice;system(cls);prin tf(nnnn);i=(*sum);doif(iMAX)printf(” tt请输入要添加的楼盘的信息:n);printf(nttt 楼盘楼号:(000):”);sca nf(%s,lo upan i. nu m);if(loupan i. num=0) break;printf(nttt 价格(/ rf):);sca nf(%s,lo

32、upan i. price);printf(nttt 面向:);sca nf(%s,lo upan i.chaoxia ng);printf(nttt 面积(单位:rf):);scan f(%d,&lou pan i.area);printf(nttt楼盘单元信息(单元-层):);sca nf(%d-%d,&loupan i.weizhi.da nyu,&loupan i.weizhi.louce n);printf(nttt 楼盘类型(厅-室):);scan f(%d-%d,&lou pan i.ki nd.da nyu,&lou pan i.ki nd.louce n);(*sum)+;i

33、=(*sum);getchar();prin tf(n成功添加一个楼盘的信息!n);getchar();printf(n是否继续添加? ( Y/N(选择N则返回主菜单)n”); choice=getchar();if(choice=Y|choice=y)flag=1;printf(n 继续添加!n); elseflag=O; elseprintf(nttt 返回主菜单 n); getch();break;while(flag=1); void mai n()int choice,sum;struct loupans_type loupan MAX;int flag;system(color 71); prin t1(); flag=logi n(); if(fla

温馨提示

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

最新文档

评论

0/150

提交评论