C语言服装管理系统.doc_第1页
C语言服装管理系统.doc_第2页
C语言服装管理系统.doc_第3页
C语言服装管理系统.doc_第4页
C语言服装管理系统.doc_第5页
已阅读5页,还剩29页未读 继续免费阅读

下载本文档

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

文档简介

服装管理系统C语言课程设计服装管理系统 专 业: 题 目: 服装管理系统 班 级: 姓 名: 学 号: 指导教师: 【整体E-R图】服装管理系统欢迎界面管理员模块店长模块销售员模块退出用户添加用户删除显示所有用户退出自身信息修改商品信息浏览营业员业绩报表商品浏览商品查找出售密码修改查看本月报表一服装管理系统 欢迎界面欢迎界面及主函数代码int main() /主函数模块 void Menu(); /声明函数 Menu(); /调用菜单函数 system(pause); /系统暂停函数 void Menu() void Admin(); int n,w; do /*用一个 do-while 循环控制输入 printf(_ MENU _nn); printf(ttt请选择您以何种方式登录:n); printf(ttt1).Adminn); /管理员模块 printf(ttt2).Shopkeepern); /店长模块 printf(ttt3).Sellern); /销售员模块 printf(ttt4).Exitn); /退出 printf( _nn); printf(Choice bb); scanf(%d,&n); if(n4) w=1; getchar(); else w=0; while(w=1); switch(n) case 1:Admin();break; /管理员模块 case 2:Shopkeeper();break; /店主模块 case 3:Region();break; /售货员模块 case 4:exit(0); /退出 管理员模块用户添加用户删除显示所有用户返回主菜单(管理员)登陆模块 void Admin() 函数void Admin() void AdminWelcome(); /管理员欢迎界面 void ChangePassWord(); /密码修改函数 FILE *fplast; /文件尾指针 FILE *fp; /文件指针 int last; int i=0; int PASS; /逻辑变量 char CPassWord20; char CID20=zhangbo; /账户 char ID20; char PassWord20; fp=fopen(AdminPassWord.db,r); fplast=fopen(AdminPassWord.db,r); fseek(fplast,0,SEEK_END); / last=ftell(fplast); for(i=0;inext=cur; cur-next=NULL; strcpy(cur-name,input); puts(请输入密码:); scanf ( %s, &cur - PassWord ); while( getchar() != n ) continue; printf(请输入下一位的用户名:(# to quit)n); fwrite( cur, sizeof (struct User), 1 , fp ); pre = cur; Cur = head; if(head=NULL) printf(您没有添加用户!); else printf(您所添加的用户:n); while(cur!=NULL) printf(ID:%s,cur-name); printf(n); printf(密码:%s,cur-PassWord); printf(n); cur=cur-next; cur=head; while(cur!=head) /释放内存 free(cur); cur=cur-next; fclose(fp);2).(管理员)用户删除模块 void Userdelete() struct User char name20; char PassWord20; struct User *next; ; struct User Users100; int n , i , m; FILE *fp; fp=fopen(UserInfo.txt,rb+); printf(请问您要删除哪位用户的记录); scanf(%d,&n); for( i=0; fread( &Usersi , sizeof (struct User) , 1 , fp ) ; i+) /*讲文件内容读入内存,并记录结构体的数目*/ m=i; strcpy(U,0); /将要删除的记录置为零 strcpy(Usersn-1.PassWord,0);fclose(fp); /关闭文件 p=fopen(UserInfo.txt,w); /以写入的方式再打开文件 for(i=0;i 0 ; i+)printf(编号:%d ID:%10s 密码:%10snn,i+1,U,Usersi.PassWord); fclose(fp); system(pause);二店长模块店长登陆界面自身信息修改商品信息浏览营业员业绩报表密码修改注销查看自身休息修改自身信息(店长)登陆界面void Shopkeeper() void ShopkeeperWelcome(); FILE *fplast; FILE *fp; int last, i=0 , PASS; char ch; char CPassWord20; char CID20=zhangbo; char ID20; char PassWord20; fp=fopen(ShopkeeperPassWord.db,r); fplast=fopen(ShopkeeperPassWord.db,r); fseek(fplast,0,SEEK_END); last=ftell(fplast); for( i=0 ; i 0 ; i+) printf(姓名:%10s 年龄:%d 性别:%s 毕业院校:%snn,,keeper1i.age,keeper1i.sex,keeper1i.school); break; case 2:fclose(fp);fp=fopen(Shopkeeper.txt,w); printf(请输入您的姓名,年龄,性别,毕业院校:n); scanf(%s%d%s%s,,&keeper10.age,keeper10.sex,keeper10.school); fwrite(&keeper10,sizeof(struct Shopkeeper),1,fp);break; default:printf(输入有误!n);break; fclose(fp); (店长)商品信息浏览void GoodsInfoView ()struct GInfomation char name20; float price; ; struct GInfomation Goods20; FILE *fp; int n , i ; fp=fopen(GInfo.txt,r); printf(nnnnnn商品信息如下:n ); printf(编号 名称 价格n); for(i=0; fread(&Goodsi,sizeof(struct GInfomation),1,fp)0;i+) printf(%3d %10s %.2fn,i+1,G,Goodsi.price); fclose(fp);(店长)营业员业绩报表void GoodsSellView() struct SellerInfo char GoodsName20; struct SellerInfo *next; ; struct SellerInfo Goods200; FILE *fp; int i , m=0; fp=fopen(SellerInfo.txt,r); for(i=0;fread(&Goodsi,sizeof(struct SellerInfo),1,fp) 0 ;i+) printf(%d %sn,i+1,Goodsi.GoodsName); m=i+1; printf(共%d件nnn,m); fclose(fp);(店长)密码修改void ChangeSPassWord() FILE *fp; char ch; printf(新密码:); getchar(); fp=fopen(ShopkeeperPassWord.db,wb); while(ch=getchar()!=n) putc(ch,fp); fclose(fp);(销售员)void Seller()int n;void Menu();void GoodsSell();void GoodsSellView(); printf(您可以做如下操作:n); printf(_nn); printf(ttt1).商品浏览n); printf(ttt2).商品查找n); printf(ttt3).出售n); printf(ttt4).查看本月报表n); printf(ttt5).返回主菜单n); printf(nnnnnnn); printf(Choice bb); scanf(%d,&n); switch(n) case 1: GoodsInfoView ();Seller();break; case 2: GoodsSearch();Seller();break; case 3: GoodsSell();Seller();break; case 4: GoodsSellView();Seller();break; case 5: Menu();break; void Region() void Seller(); struct User char name20; /用户名 char PassWord20; /密码 struct User *next; /指向下一个结构体的指针 ;struct User Users20;char cID30;char cPW20;int w=0;FILE *fp;int i;fp=fopen(UserInfo.txt,rb);doprintf(nntttID:_bbbbbbbbbbbbbbb);scanf(%s, cID);printf(nntttPW:_bbbbbbbbbbbbbbb);scanf(%s,cPW); for (i = 0; fread(&Usersi,sizeof(struct User),1,fp) 0; i+)if(strcmp(cID,U) = 0 & strcmp(cPW,Usersi.PassWord) = 0) w=1;break;else w=0;if(w=1) Seller(); else printf(输入错误 ); while(w!=1); fclose(fp); system(pause);(销售员)(销售员)商品浏览void GoodsInfoView () 同店长一个函数 (销售员)商品查找void GoodsSearch() /商品查找 struct GInfomation char name20; float price; ; FILE *fp; FILE *head , *last; int n; struct GInfomation Goods20; fp=fopen(GInfo.txt,r); printf(请输入查找的商品编号); scanf(%d,&n); fseek(fp,(n-1)*sizeof(struct GInfomation),SEEK_SET); fread(&Goodsn-1,sizeof(struct GInfomation),1,fp); printf(%s %.2f,G,Goodsn-1.price);fclose(fp); (销售员)商品出售void GoodsSell() /商品出售 struct SellerInfo char GoodsName20; struct SellerInfo *next; ; FILE *fp; struct SellerInfo *head=NULL, *pre , *cur; char input20; fp=fopen(SellerInfo.txt,ab); printf(请输入您要出售的商品的名称:n); gets(input); while(gets(input)!=NULL & input0!=#) cur=(struct SellerInfo *)malloc(sizeof(struct SellerInfo); if(head=NULL) head=cur;else pre-next=cur;cur-next=NULL; strcpy(cur-GoodsName,input);fwrite(cur,sizeof(struct SellerInfo),1,fp);printf(请输入您的下一商品的名称,如果没有,请按#:);pre=cur; fclose(fp); (销售员)查看报表void GoodsSellView() .同店长营业员业绩报表参考文献1.谭浩强.C程序设计.清华大学出版社,1991年第一版.2.张冬梅.C语言课程设计与学习指导.中国铁道出版社2008年第一版源代码如下:#include #include #include /*管理员登陆模块*/void Admin() void AdminWelcome(); /管理员欢迎界面 void ChangePassWord(); /密码修改函数 FILE *fplast; /文件尾指针 FILE *fp; /文件指针 int last; int i=0; int PASS; /逻辑变量 char CPassWord20; char CID20=zhangbo; /账户 char ID20; char PassWord20; fp=fopen(AdminPassWord.db,r); fplast=fopen(AdminPassWord.db,r); fseek(fplast,0,SEEK_END); last=ftell(fplast); for(i=0;i 0 ; i+)printf(编号:%d ID:%10s 密码:%10snn,i+1,U,Usersi.PassWord); fclose(fp); system(pause); /*用户添加*/ void UserAdd() int i; struct User char name20; /用户名 char PassWord20; /密码 struct User *next; /指向下一个结构体的指针 ; struct User *head=NULL,*cur,*pre; FILE *fp; fp=fopen(UserInfo.txt,a); char input20; printf(请输入您第一位用户的ID:n); while(scanf(%s,input)!=NULL & input0!=#) cur=(struct User *)malloc(sizeof(struct User); if(head=NULL) head=cur; else pre-next=cur; cur-next=NULL; strcpy(cur-name,input); puts(请输入密码:); scanf(%s,&cur-PassWord); while(getchar()!=n) continue; printf(请输入下一位的用户名:(# to quit)n); fwrite(cur,sizeof(struct User),1,fp); pre=cur; cur=head; if(head=NULL) printf(您没有添加用户!); else printf(您所添加的用户:n); while(cur!=NULL) printf(ID:%s,cur-name); printf(n); printf(密码:%s,cur-PassWord); printf(n); cur=cur-next; cur=head; while(cur!=head) /释放内存 free(cur); cur=cur-next; fclose(fp); /* _用户删除 _*/ void Userdelete() struct User char name20; char PassWord20; struct User *next; ; struct User Users100; int n , i , m; FILE *fp; fp=fopen(UserInfo.txt,rb+); printf(请问您要删除哪位用户的记录); scanf(%d,&n); for(i=0;fread(&Usersi,sizeof(struct User),1,fp);i+) m=i; strcpy(U,0); strcpy(Usersn-1.PassWord,0);fclose(fp); fp=fopen(UserInfo.txt,w); for(i=0;im+1;i+) if(strcmp(U,0)=0 & strcmp(Usersi.PassWord,0)=0) continue; fwrite(&Usersi,sizeof(struct User),1,fp); fclose(fp);/*管理员修改密码函数*/void ChangeAPassWord() FILE *fp; char ch; printf(新密码:); getchar(); fp=fopen(AdminPassWord.db,wb); while(ch=getchar()!=n) putc(ch,fp); fclose(fp);/* 店长模块 */void Shopkeeper() void Shopkeeper

温馨提示

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

评论

0/150

提交评论