设计超市管理的系统.docx

上传人:b****2 文档编号:2253765 上传时间:2022-10-28 格式:DOCX 页数:31 大小:119.87KB
下载 相关 举报
设计超市管理的系统.docx_第1页
第1页 / 共31页
设计超市管理的系统.docx_第2页
第2页 / 共31页
设计超市管理的系统.docx_第3页
第3页 / 共31页
设计超市管理的系统.docx_第4页
第4页 / 共31页
设计超市管理的系统.docx_第5页
第5页 / 共31页
点击查看更多>>
下载资源
资源描述

设计超市管理的系统.docx

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

设计超市管理的系统.docx

设计超市管理的系统

1.课程设计的目的

随着社会的发展,超市成为百姓购买日常用品的首选之地,琳琅满目的商品在管理方面也是一大问题,超市对商品的管理统计是很重要的,因此一个超市商品管理系统可以大大地帮助超市人员管理商品情况。

以下程序供参考使用:

该程序一共有5个模块6个选项,不但可以进行超市商品信息的显示,修改,删除,更可以对商品的价格进行统计,对商品的进货价格出货价格以及净利润等进行统计,操作界面简洁,方便的进行操作。

程序用了指针、链表、数组.结构体等知识点,可运用于小的管理软件。

软件运用菜单实现交互式管理,用户轻松的按键既可实现对软件的操作,操作简单,功能使用可以满足一般小型超市的管理,用户对进货出货的价格数量一目了然。

22.设计方案论证

2.1设计思路

建立一个全局链表,在内存中存储数据,例如:

商品数量出货进货价格等。

主函数可以调用5个模块函数,分别完成增加,显示,修改,删除,商品详细,结束等功能。

在主函数中可以设置调用5个函数的方法,按1,2,3,4,5,6数字键,则分别可以执行某个功能模块。

主要功能模块即如图1所示:

图1.超市管理功能模块

2.2.程序设计

自定义函数就是一般先进行函数声明,然后进行定义。

①数据结构体的定义:

将一个货物的信息作为一个结构体,由于利用链表所以

在结构体中别忘记指向后继结点的指针。

如下:

structstudent

{

intno;

charname[20];

intzong;

floatjin;

floatchu;

intchuliang;

floatsort;

intkucun;

floatxiaoshousum;

floatjingliave;

};

②main()主函数:

主函数是程序的入口,利用循环语句,当运行到指定函数入口时,跳出循环,执行其他模块方法,当选择退出时结束整个程序。

③商品详细信息如图2

图2.显示信息

④买卖信息如图3

图3.查询信息

⑤删除信息如图4

图4.删除信息

⑥修改信息如图5

图5修改信息

2.3.源程序

#include

#include

#include

#include

#defineMAX50

voidprudctInfo();

voidsort();

voidprudctgoto();

voidprudctinsert();

voidprudctdelete();

voidprudctupdate();

voidaverage();

intnow_no=0;

structstudent

{

intno;

charname[20];

intzong;

floatjin;

floatchu;

intchuliang;

floatsort;

intkucun;

floatxiaoshousum;

floatjingliave;

};

structstudentstu[MAX],*p;

main()//主函数

{

charas;

start:

printf("\t\t\t\t超市商品管理系统\n\n");

//一下为功能选择模块

do{

printf("\n\t\t\t\t1.商品详细\n\t\t\t\t2.商品买卖\n\t\t\t\t3.库存商品登陆\n\t\t\t\t4.库存商品删除\n\t\t\t\t5.库存商品修改\n\t\t\t\t6.退出\n");

printf("\t\t\t\t选择功能选项:

");

as=getch();

switch(as)

{

case'1':

system("cls");

prudctInfo();

break;

case'2':

system("cls");

prudctgoto();

break;

break;

case'3':

system("cls");

prudctinsert();

break;

case'4':

system("cls");

prudctdelete();

break;

case'5':

system("cls");

prudctupdate();

break;

case'6':

system("exit");

exit(0);

default:

system("cls");

gotostart;

}

}while

(1);

//至此功能选择结束

}

 

voidprudctInfo()//显示数据函数

{

inti;

charas;

floatave;

do

{

printf("\t\t商品详细\n");

printf("\t编号\t商品名\t库存\t单价\t销售数\t销售额\t净利润\n");

for(i=0;i

{

stu[i].kucun=stu[i].zong-stu[i].chuliang;

stu[i].xiaoshousum=stu[i].chu*stu[i].chuliang;

stu[i].jingliave=stu[i].chu*(stu[i].chu-stu[i].jin);

printf("\t%d\t%s\t%d\t%.2f\t%d\t%.2f\t%.2f\n",

stu[i].no,stu[i].name,stu[i].kucun,stu[i].chu,stu[i].chuliang,stu[i].xiaoshousum,stu[i].jingliave);

}

printf("\t\t按任意键返回主菜单.");

as=getch();

gotoexit;

}

while(as!

='n');

exit:

system("cls");

}

voidprudctgoto()//插入数据函数

{

inti=0;

charch;

intnumberID=0;

intgeshu=0;

inta=0;

do

{

printf("\t\t商品一览\n");

printf("\t编号\t商品名\t库存\t单价\n");

for(i=0;i

{

stu[i].kucun=stu[i].zong-stu[i].chuliang;

printf("\t%d\t%s\t%d\t%.2f\n",

stu[i].no,stu[i].name,stu[i].kucun,stu[i].chu);

}

a=-1;

printf("\n商品编号:

");

scanf("%d",&numberID);

for(i=0;i

{

if(stu[i].no==numberID){

a=i;

}

}

 

if(a==-1){

printf("没这个商品!

");

ch=getch();

system("cls");

}else{

printf("\n卖出个数:

");

scanf("%d",&geshu);

if(stu[a].zong

printf("没这么多商品");

ch=getch();

system("cls");

}else{

fflush(stdin);

stu[a].chuliang=geshu;

}

}

printf("是否继续输入?

(Y/N)");

ch=getch();

system("cls");

}

while(ch!

='n');

system("cls");

}

 

voidprudctinsert()//原始数据录入模块

{

inti=0;

charch;

do

{

printf("\t\t\t\t1.输入商品信息\n输入第%d个商品情报\n",i+1);

printf("\n登陆商品编号:

");

scanf("%d",&stu[i].no);

fflush(stdin);

printf("\n登陆商品名:

");

fflush(stdin);

gets(stu[i].name);

printf("\n登陆超市进货商品个数:

");

fflush(stdin);

scanf("%d",&stu[i].zong);

printf("\n登陆商品进货单价:

");

fflush(stdin);

scanf("%f",&stu[i].jin);

printf("\n登陆商品售出单价:

");

fflush(stdin);

scanf("%f",&stu[i].chu);

stu[i].chuliang=0;

printf("\n\n");

i++;

now_no=i;

printf("%d",now_no);

printf("是否继续输入?

(Y/N)");

ch=getch();

system("cls");

}

while(ch!

='n');

system("cls");

}

voidprudctdelete(){

intinum,i,j;

printf("输入要删除商品编号:

");

fflush(stdin);

scanf("%d",&inum);

for(i=0;i

{

if(stu[i].no==inum)

{

for(j=i;j

{

stu[i]=stu[i+1];

}

now_no=now_no-1;

}

break;

}

system("cls");

}

 

voidprudctupdate(){

charch;

do

{

printf("\n\t\t输入新商品信息\n");

printf("\n登陆商品编号:

");

scanf("%d",&stu[now_no].no);

fflush(stdin);

printf("\n登陆商品名:

");

fflush(stdin);

gets(stu[now_no].name);

printf("\n登陆超市进货商品个数:

");

fflush(stdin);

scanf("%d",&stu[now_no].zong);

printf("\n登陆商品进货单价:

");

fflush(stdin);

scanf("%f",&stu[now_no].jin);

printf("\n登陆商品售出单价:

");

fflush(stdin);

scanf("%f",&stu[now_no].chu);

printf("\n登陆超市商品卖去个数:

");

fflush(stdin);

scanf("%d",&stu[now_no].chuliang);

 

printf("\n\n");

now_no=now_no+1;

printf("是否继续输入?

(Y/N)");

ch=getch();

system("cls");

}

while(ch!

='n');

}

 

voidsort()//排序

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

当前位置:首页 > 人文社科 > 法律资料

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

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