服装管理系统.docx

上传人:b****6 文档编号:3381520 上传时间:2022-11-22 格式:DOCX 页数:42 大小:225.03KB
下载 相关 举报
服装管理系统.docx_第1页
第1页 / 共42页
服装管理系统.docx_第2页
第2页 / 共42页
服装管理系统.docx_第3页
第3页 / 共42页
服装管理系统.docx_第4页
第4页 / 共42页
服装管理系统.docx_第5页
第5页 / 共42页
点击查看更多>>
下载资源
资源描述

服装管理系统.docx

《服装管理系统.docx》由会员分享,可在线阅读,更多相关《服装管理系统.docx(42页珍藏版)》请在冰豆网上搜索。

服装管理系统.docx

服装管理系统

服装管理系统

服装治理系统

 

专业:

网络工程

题目:

服装治理系统

班级:

193092班

*****

学号:

*******2676

**************************

 

【整体E-R图】

 

 

一.服装治理系统

欢迎界面

 

欢迎界面及主函数代码

intmain()//主函数模块

{

voidMenu();//声明函数

Menu();//调用菜单函数

system("pause");//系统暂停函数

}

voidMenu()

{

voidAdmin();

intn,w;

do

/*用一个do-while循环操纵输入

{

printf("_____________________________MENU_____________________________\n\n");

printf("\t\t\t请选择您以何种方式登录<1-4>:

\n");

printf("\t\t\t1).Admin\n");//治理员模块

printf("\t\t\t2).Shopkeeper\n");//店长模块

printf("\t\t\t3).Seller\n");//销售员模块

printf("\t\t\t4).Exit\n");//退出

printf("_______________________________________________________________\n\n");

printf("Choice[]\b\b");

scanf("%d",&n);

if(n<1||n>4)

{

w=1;

getchar();

}

else

w=0;

}while(w==1);

switch(n)

{

case1:

Admin();break;//治理员模块

case2:

Shopkeeper();break;//店主模块

case3:

Region();break;//售货员模块

case4:

exit(0);//退出

}

}

 

(治理员)登陆模块voidAdmin()函数

voidAdmin()

{

voidAdminWelcome();//治理员欢迎界面

voidChangePassWord();//密码修改函数

FILE*fplast;//文件尾指针

FILE*fp;//文件指针

intlast;

inti=0;

intPASS;//逻辑变量

charCPassWord[20];

charCID[20]="zhangbo";//账户

charID[20];

charPassWord[20];

fp=fopen("AdminPassWord.db","r");

fplast=fopen("AdminPassWord.db","r");

fseek(fplast,0,SEEK_END);//

last=ftell(fplast);

for(i=0;i

{

CPassWord[i]=fgetc(fp);

}

CPassWord[i]='\0';

fclose(fp);

printf("您好治理员,请输入您的账户及密码[ENTER]终止\n\n\n");

do

{

printf("\t\t\t账户__________________\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");

scanf("%s",ID);

printf("\t\t\t密码__________________\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");

scanf("%s",PassWord);

if(strcmp(CPassWord,PassWord)==0&&strcmp(CID,ID)==0)

{

printf("Welcome!

\n\n");

PASS=1;

AdminWelcome();

}

else

{printf("PasswordorIDerror\n");PASS=0;}

}while(PASS!

=1);

}

运行结果如下:

 

1).(治理员)用户添加模块

/*****用户添加********/

voidUserAdd()

{

inti;

structUser

{

charname[20];//用户名

charPassWord[20];//密码

structUser*next;//指向下一个结构体的指针

};

structUser*head=NULL,*cur,*pre;

FILE*fp;

fp=fopen("UserInfo.txt","a");

charinput[20];

printf("请输入您第一位用户的ID:

\n");

/*创建动态线性链表*/

while(scanf("%s",input)!

=NULL&&input[0]!

='#')

{

cur=(structUser*)malloc(sizeof(structUser));

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("请输入下一位的用户名:

(#toquit)\n");

fwrite(cur,sizeof(structUser),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).(治理员)用户删除模块

voidUserdelete()

{

structUser

{

charname[20];

charPassWord[20];

structUser*next;

};

structUserUsers[100];

intn,i,m;

FILE*fp;

fp=fopen("UserInfo.txt","rb+");

printf("请问您要删除哪位用户的记录");

scanf("%d",&n);

for(i=0;fread(&Users[i],sizeof(structUser),1,fp);i++)

{/*讲文件内容读入内存,并记录结构体的数目*/

m=i;

}

strcpy(Users[n-1].name,"0");//将要删除的记录置为零

strcpy(Users[n-1].PassWord,"0");

fclose(fp);//关闭文件

p=fopen("UserInfo.txt","w");//以写入的方式再打开文件

for(i=0;i

{//将内存储备的结构体值送到文件中,假如遇到零,就跃过*/

if(strcmp(Users[i].name,"0")==0&&strcmp(Users[i].PassWord,"0")==0)continue;

fwrite(&Users[i],sizeof(structUser),1,fp);

}

fclose(fp);

}

运行结果如下

 

删除前:

删除第一位用户后:

 

3).(治理员)显示所有用户模块

voidUserView()

{

inti;

structUser

{

charname[20];

charPassWord[20];

structUser*next;

};

structUserUsers[20];

FILE*fp;

fp=fopen("UserInfo.txt","rb");

for(i=0;fread(&Users[i],sizeof(structUser),1,fp)>0;i++)

{

printf("编号:

%dID:

%10s密码:

%10s\n\n",i+1,Users[i].name,Users[i].PassWord);

}

fclose(fp);

system("pause");

}

二.店长模块

(店长)登陆界面

voidShopkeeper()

{

voidShopkeeperWelcome();

FILE*fplast;

FILE*fp;

intlast,i=0,PASS;

charch;

charCPassWord[20];

charCID[20]="zhangbo";

charID[20];

charPassWord[20];

fp=fopen("ShopkeeperPassWord.db","r");

fplast=fopen("ShopkeeperPassWord.db","r");

fseek(fplast,0,SEEK_END);

last=ftell(fplast);

for(i=0;i

{

CPassWord[i]=fgetc(fp);

}

CPassWord[i]='\0';

fclose(fp);

printf("您好店长,请输入您的账户及密码[ENTER]终止\n\n\n");

do

{

printf("\t\t\t账户__________________\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");

scanf("%s",ID);

printf("\t\t\t密码__________________\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");

scanf("%s",PassWord);

if(strcmp(CPassWord,PassWord)==0&&strcmp(CID,ID)==0)

{printf("Welcome!

\n\n\n\n");PASS=1;ShopkeeperWelcome();}

else

{printf("PasswordorIDerror\n");PASS=0;}

}while(PASS!

=1);

getchar();

}

 

(店长)自身信息修改

voidChangesInfo()

{

structShopkeeper

{

charname[20];//姓名

intage;//年龄

charsex[5];//性别

charschool[40];//毕业院校

};

structShopkeeperkeeper1[2];

FILE*fp;

inti,n;

fp=fopen("Shopkeeper.txt","r");

printf("1)查看自身信息2)修改自身信息\n");

printf("choice[]\b\b");

scanf("%d",&n);

switch(n)

{

case1:

for(i=0;fread(&keeper1[i],sizeof(structShopkeeper),1,fp)>0;i++)

{printf("姓名:

%10s年龄:

%d性别:

%s毕业院校:

%s\n\n",keeper1[i].name,keeper1[i].age,keeper1[i].sex,keeper1[i].school);}

break;

case2:

fclose(fp);fp=fopen("Shopkeeper.txt","w");

printf("请输入您的姓名,年龄,性别,毕业院校:

\n");

scanf("%s%d%s%s",keeper1[0].name,&keeper1[0].age,keeper1[0].sex,keeper1[0].school);

fwrite(&keeper1[0],sizeof(structShopkeeper),1,fp);break;

default:

printf("输入有误!

\n");break;

}

fclose(fp);

}

 

(店长)商品信息扫瞄

voidGoodsInfoView()

{

structGInfomation

{

charname[20];

floatprice;

};

structGInfomationGoods[20];

FILE*fp;

intn,i;

fp=fopen("GInfo.txt","r");

printf("\n\n\n\n\n\n商品信息如下:

\n");

printf("编号名称价格\n");

for(i=0;fread(&Goods[i],sizeof(structGInfomation),1,fp)>0;i++)

{

printf("%3d%10s%.2f\n",i+1,Goods[i].name,Goods[i].price);

}

fclose(fp);

}

 

 

(店长)营业员业绩报表

voidGoodsSellView()

{

structSellerInfo

{

charGoodsName[20];

structSellerInfo*next;

};

structSellerInfoGoods[200];

FILE*fp;

inti,m=0;

fp=fopen("SellerInfo.txt","r");

for(i=0;fread(&Goods[i],sizeof(structSellerInfo),1,fp)>0;i++)

{

printf("%d%s\n",i+1,Goods[i].GoodsName);m=i+1;

}

printf("共%d件\n\n\n",m);

fclose(fp);

}

 

(店长)密码修改

voidChangeSPassWord()

{

FILE*fp;

charch;

printf("新密码:

");

getchar();

fp=fopen("ShopkeeperPassWord.db","wb");

while((ch=getchar())!

='\n')

{

putc(ch,fp);

}

fclose(fp);

}

(销售员)

voidSeller()

{

intn;

voidMenu();

voidGoodsSell();

voidGoodsSellView();

printf("您能够做如下操作:

<1-4>\n");

printf("__________________________________________________\n\n");

printf("\t\t\t1).商品扫瞄\n");

printf("\t\t\t2).商品查找\n");

printf("\t\t\t3).出售\n");

printf("\t\t\t4).查看本月报表\n");

printf("\t\t\t5).返回主菜单\n");

printf("\n\n\n\n\n\n\n");

printf("Choice[]\b\b");

scanf("%d",&n);

switch(n)

{

case1:

GoodsInfoView();Seller();break;

case2:

GoodsSearch();Seller();break;

case3:

GoodsSell();Seller();break;

case4:

GoodsSellView();Seller();break;

case5:

Menu();break;

}

}

voidRegion()

{

voidSeller();

structUser

{

charname[20];//用户名

charPassWord[20];//密码

structUser*next;//指向下一个结构体的指针

};

structUserUsers[20];

charcID[30];

charcPW[20];

intw=0;

FILE*fp;

inti;

fp=fopen("UserInfo.txt","rb");

do

{

printf("\n\n\t\t\tID:

_______________\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");

scanf("%s",cID);

printf("\n\n\t\t\tPW:

_______________\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");

scanf("%s",cPW);

for(i=0;fread(&Users[i],sizeof(structUser),1,fp)>0;i++)

{

if(strcmp(cID,Users[i].name)==0&&strcmp(cPW,Users[i].PassWord)==0){w=1;break;}

else

w=0;

}

if(w==1)

Seller();

else

printf("输入错误");

}while(w!

=1);

fclose(fp);

system("pause");

}

(销售员)

(销售员)商品扫瞄

voidGoodsInfoView()………………同店长一个函数

 

(销售员)商品查找

voidGoodsSearch()//商品查找

{

structGInfomation

{

charname[20];

floatprice;

};

FILE*fp;

FILE*head,*last;

intn;

structGInfomationGoods[20];

fp=fopen("GInfo.txt","r");

printf("请输入查找的商品编号");

scanf("%d",&n);

fseek(fp,(n-1)*sizeof(structGInfomation),SEEK_SET);

fread(&Goods[n-1],sizeof(structGInfomation),1,fp);

printf("%s%.2f",Goods[n-1].name,Goods[n-1].price);

fclose(fp);

}

(销售员)商品出售

voidGoodsSell()//商品出售

{

structSellerInfo

{

charGoodsName[20];

structSellerInfo*next;

};

FILE*fp;

structSellerInfo*head=NULL,*pre,*cur;

charinput[20];

fp=fopen("SellerInfo.txt","ab");

printf("请输入您要出售的商品的名称:

\n");

gets(input);

while(gets(input)!

=NULL&&input[0]!

='\#')

{

cur=(structSellerInfo*)malloc(sizeof(structSellerInfo));

if(head==NULL)

head=cur;

else

pre->next=cur;

cur->next=NULL;

strcpy(cur->GoodsName,input);

fwrite(cur,sizeof(structSellerInfo),1,fp);

printf("请输入您的下一商品的名称,假如没有,请按#:

");

pre=cur;

}

fclose(fp);

}

(销售员)查看报表

voidGoodsSellView()….同店长营业员业绩报表

参考文献

1.谭浩强.《C程序设计》.清华大学出版社,1991年第一版.

2.张冬梅.《C语言课程设计与学习指导》.中国铁道出版社2008年第一版

源代码如下:

#include

#include

#include

/***********************治理员登陆模块****************************/

voidAdmin()

{

voidAdminWelcome();//治理员欢迎界面

voidChangePassWord();//密码修改函数

FILE*fplast;//文件尾指针

FILE*fp;//文件指针

intla

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 小学教育 > 语文

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1