销售管理商品销售管理系统设计Word格式文档下载.docx

上传人:b****7 文档编号:21968357 上传时间:2023-02-02 格式:DOCX 页数:32 大小:22.15KB
下载 相关 举报
销售管理商品销售管理系统设计Word格式文档下载.docx_第1页
第1页 / 共32页
销售管理商品销售管理系统设计Word格式文档下载.docx_第2页
第2页 / 共32页
销售管理商品销售管理系统设计Word格式文档下载.docx_第3页
第3页 / 共32页
销售管理商品销售管理系统设计Word格式文档下载.docx_第4页
第4页 / 共32页
销售管理商品销售管理系统设计Word格式文档下载.docx_第5页
第5页 / 共32页
点击查看更多>>
下载资源
资源描述

销售管理商品销售管理系统设计Word格式文档下载.docx

《销售管理商品销售管理系统设计Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《销售管理商品销售管理系统设计Word格式文档下载.docx(32页珍藏版)》请在冰豆网上搜索。

销售管理商品销售管理系统设计Word格式文档下载.docx

ctype.h"

/*字符操作函数*/

time.h"

/*时钟函数*/

cstdlib"

conio.h"

intx,k;

/*定义全局变量用于保存当前商品种类*/

structproduct/*定义商品数据结构*/

{

intnum;

/*商品编号*/

charname[20];

/*商品名称*/

floatprice;

/*商品售价*/

charplace[10];

intstorage;

/*商品库存*/

}_product[10],product1[10];

//定义主结构体数组和备用结构体数组

structdata//定义日期结构体

{intyear,month,day;

};

structsell/*定义销售数据结构*/

intcus;

/*顾客代码*/

/*商品编号*/

floatsells;

/*销售数量*/

chardata1[12];

/*日期*/

structsell*next;

}*head_s,*pp,*tail_s;

//定义头指针操、作指针以及尾指针

structcustomer/*定义销售数据结构*/

charname[10];

/*顾客姓名*/

structcustomer*next;

}*head_c,*qq,*tail_c;

voidload();

//读取文件函数

voidadd();

//添加销售信息函数

intsearch_num();

//根据商品编号查询商品的销售历史

voidcal();

//计算时间段内各个商品的销售总额

intsearch_name();

//根据顾客姓名,查询购买历史

voidlist_name();

//显示所有顾客的姓名

voidmain();

//主函数

intjudge();

//主体判断函数

intjudge_data(char*data1);

//细节判断函数,用于判断日期是否合法

voiddownload_s();

//写入销售信息(顾客代码,销售数量、销售日期)文件

voiddownload_c();

//导出顾客购买记录

voiddisplay();

//显示现在的商品信息

voidmain()

intchoice;

structcustomer*head;

//定义结构指针

head=malloc(sizeof(structcustomer));

//申请动态存储空间

head->

next=NULL;

do

{

printf("

***********************欢迎使用商品销售管理系统!

!

*******************\n\n"

);

1.导入商品信息\n"

2.显示商品信息\n"

3.输入销售记录记录\n"

4.按编号查寻商品销售历史\n"

5.计算时间段内各个销售总额\n"

6.按顾客姓名查找购买历史\n"

7.显示顾客姓名\n"

8.导出销售信息(顾客代码,销售数量、销售日期)文件\n"

9.导出顾客信息文件\n"

0.退出\n"

***********************************************************************\n"

请选择不同功能输入0----9的数字\n若输入其它值会提前退出\n"

scanf("

%d"

&

choice);

system("

cls"

switch(choice)

{

case1:

load();

break;

case2:

display();

case3:

add();

case4:

search_num();

case5:

cal();

case6:

search_name();

case7:

list_name(head);

case8:

download_s();

case9:

download_c();

case0:

\n\n\n\n"

*************谢谢使用************\n\n\n\n"

}

}while(choice>

0&

&

choice<

=9);

}

voiddisplay()

intcode,i=0;

pp=(structsell*)malloc(sizeof(structsell));

//申请动态存储空间并将指针转变为结构类型

qq=(structcustomer*)malloc(sizeof(structcustomer));

pp->

qq->

system("

/*清屏*/

printf("

**************************商品信息**************************\n\n\n"

商品编号 

商品名称 

商品价格 

商品产地 

库存数量\n"

while(i<

10) 

//输出商品记录

%8d%12s 

%12.2f%10s%14d\n"

_product[i].num,_product[i].name,_product[i].price,

_product[i].place,_product[i].storage);

i++;

}

\n\n查询完毕,请按任意键继续......"

getch();

voidload(){//读取文件函数

inti=0,n=0,a,b,j;

FILE*fp;

//指向文件的指针

do{

请选择导入商品信息的方法\n1:

通过键盘输入\n2:

通过文件导入\n"

scanf("

a);

if(a==2){

if((fp=fopen("

商品信息.txt"

"

rb"

))==NULL)//打开文件

不能打开文件,请检查文件路径\n"

//不能打开

exit(0);

//退出*/

}printf("

*****************88商品信息88*******************\n"

编号 

名称 

价格 

产地 

while(!

feof(fp)) 

//读入文件

fscanf(fp,"

%d%s%f%s%d"

_product[i].num,_product[i].name,&

_product[i].price,_product[i].place,&

_product[i].storage);

%-10d%-10s%-10.2f%-12s%-12d\n"

_product[i].num,_product[i].name,_product[i].price,_product[i].place,_product[i].storage);

for(i=0;

i<

10;

i++)

product1[i]=_product[i];

//对备用结构体数组赋值

fclose(fp);

//关闭文件

\t\t数据读入成功!

按任意键继续......\n"

if(a==1)

{if((fp=fopen("

商品信息1.txt"

w"

请输入商品种数"

b);

*************商品信息***************\n"

产地 

库存数量\n"

for(j=1;

j<

=b;

j++){

fprintf(fp,"

%-6d%-6s%-6.2f%-6s%-6d\n"

fclose(fp);

}while(a!

=1&

a!

=2);

intjudge_data(char*data1)

intn=1,m,year=(data1[0]-48)*1000+(data1[1]-48)*100+(data1[2]-48)*10+(data1[3]-48),

month=(data1[5]-48)*10+(data1[6]-48),day=(data1[8]-48)*10+(data1[9]-48);

m=strlen(data1);

if(m!

=10)

n=0;

if(data1[4]!

='

-'

||data1[7]!

if(year>

10000||year<

1000||month>

12||month<

1||day>

31||day<

1)n=0;

if(((year%4==0&

year%100!

=0)||(year%400==0))&

month==2)

if(day>

30)n=0;

if(month==2&

day>

=29)n=0;

if(month==4||month==6||month==9||month==11)

returnn;

//判断函数

intjudge()//判断商品编号数量日期是否正确

inti,j=0,k,temp;

if(pp->

num==_product[i].num)

j++;

x=k=i;

temp=_product[k].storage;

if((_product[k].storage-(int)pp->

sells)>

=0)

_product[k].storage-=(int)pp->

sells;

//判断计算剩余量

if(j==0)return3;

//判断是否存在输入编号的商品

elseif(temp-(int)pp->

sells<

0)return2;

//判断输入量是否大于剩余库存量

elseif(pp->

sells-(int)pp->

sells>

=1e-6)return4;

//商品量

elseif(judge_data(pp->

data1)==0)return0;

//判断日期

elsereturn1;

//完全正确

voidadd()

{

intcode,i=0,n,m;

srand(time(0));

code=rand();

请输入销售记录\n\n\n"

/*提示输入记录*/

顾客姓名 

商品编号 

销售数量 

销售日期\n"

-----------------------------------------------------------\n"

%s%d%f%s"

qq->

name,&

num,&

sells,pp->

data1);

/*输入记录*/

n=(int)pp->

if(n<

=0)

商品数量有误!

请从新输入"

%f"

sells);

while

(1)

m=judge();

//判断商品编号数量日期是否正确

if(m==1){ 

//pp=(structsell*)malloc(sizeof(structsell));

//qq=(structcustomer*)malloc(sizeof(structcustomer));

pp->

cus=qq->

cus=code;

//随机数

if(head_s==NULL)

he

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

当前位置:首页 > 高等教育 > 农学

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

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