永发信息网

怎么用C++设计商场销售管理系统的程序?

答案:2  悬赏:60  手机版
解决时间 2021-04-06 02:32
请高手指教下,从哪方面下手?? 配送系统和结帐系统销售管理要解决的问题包括、退货单、现金销售、返库单、车辆平衡表;结帐系统包括:销售开票、商场付款、零售开票、其他收款。等,配送系统包括送货单
最佳答案
构造
4你的先去了解一下你所编的商场销售管理系统主要是作什么的在了解一下用户想用这个做什么,完成什么样的功能主要你可以从这几个方面下手
1.细化
3.初始
2
全部回答
//为了顺便练习一下使用链表结构,所以用链表结构实现。
// -----by kuaidh00--------2008/01/08-------------
//****************************************************
#include <iostream>
#include <string>
#include <iomanip>
#include <stdio.h>


using namespace std;

struct sale
{
 //数据域。
 string m_code;
 string m_name;
 float m_price;
 unsigned int m_quantity;
 //指针域。
 struct sale* next;
};

typedef struct sale node;//取外别名,node.
typedef node* link;//取个别名,link.

//创建链表。
link create(link head)
{
 //-----初始化头节点 head-------
 head=(link)new node;//每次动态分配一个node内存大小。
 head->m_code="";
 head->m_name="";
 head->m_price=0.0;
 head->m_quantity=0;
 head->next=null;

 //-----
 link ptr;//定义一个用来运算的指针 ptr。 
 ptr=head;//指到首节点。
 link dnode;//定义数据节点,用来存放数据。
 char goon;
 do
 {
 cout<<"商品信息录入! "<<endl;
 string code,name;
 float price;
 unsigned int quantity;
 cout<<"输入代码:"<<endl;
 cin>>code;
 cout<<"输入名称:"<<endl;
 cin>>name;
 cout<<"输入价格:"<<endl;
 cin>>price;
 while(cin.fail())
 {
 cout<<"请输入正确的格式:"<<endl;
 cin.clear();
 fflush(stdin);
 cin>>price;
 }
 cout<<"输入数量:"<<endl;
 cin>>quantity;
 while(cin.fail())
 {
 cout<<"请输入正确的格式:"<<endl;
 cin.clear();
 fflush(stdin);
 cin>>quantity;
 }
 //----数据域-----
 dnode=(link)new node;//每次动态分配一个node内存大小。
 dnode->m_code=code;
 dnode->m_name=name;
 dnode->m_price=price;
 dnode->m_quantity=quantity;
 //----指针域-----
 dnode->next=null;//作为尾节点加入。
 ptr->next=dnode;//链入链表中。
 ptr=dnode;//使新节点成为下一次的前驱。
 cout<<"商品信息录入成功! 是否继续录入?(y/n) ";
 cin>>goon;

 }while(goon=='y'||goon=='y');
 return head;
}

//释放链表。
void release(link head)
{
 link ptr;
 while(head!=null)
 {
 ptr=head;
 head=head->next;
 delete ptr;
 }
}

//查询。
link search(link head,string& code)
{
 link ptr;
 //link front;
 ptr=head;//定义一个用于操作的指针ptr。
 //ptr=fornt->next;
 while(ptr!=null)
 {
 if(ptr->m_code==code)
 return ptr;
 else
 ptr=ptr->next;
 }
 cout<<"无此商品!"<<endl;
 return ptr;//此时的ptr为null了。
}

//打印链表。
void display(link head)
{
 link ptr;
 ptr=head->next;//,不要头节点,只输出数据节点。
 cout<<"==========================================================="<<endl;
 cout<<"===============所有商品信息清单============================"<<endl;
 cout<<"==========================================================="<<endl;
 cout<<"货品代码=======货品名称======货品价格======货品数量===="<<endl;
 while(ptr!=null)
 {
 cout<<setw(15)<<left<<ptr->m_code
 <<setw(15)<<left<<ptr->m_name
 <<setw(15)<<left<<ptr->m_price
 <<setw(15)<<left<<ptr->m_quantity<<endl;
 ptr=ptr->next;
 }
}
void display_one(link head,string& code,unsigned quantity)
{
 link ptr;
 ptr=search(head,code);//,不要头节点,只输出数据节点。
 cout<<"货品代码=======货品名称======货品价格======货品数量======小计(元)===="<<endl;
 cout<<setw(15)<<left<<ptr->m_code
 <<setw(15)<<left<<ptr->m_name
 <<setw(15)<<left<<ptr->m_price
 <<setw(15)<<left<<quantity
 <<setw(15)<<left<<quantity*ptr->m_price<<endl;

}


//单个商品小结。
float checkout(link head,string& code,unsigned quantity)
{
 link ptr;
 float sum(0); 
 ptr=search(head,code);
 sum=(ptr->m_price*quantity);
 return sum;
}

//总结帐。
void total(link head)
{
 link ptr;
 ptr=head;
 float sum(0);
 float factly;
 char goon;
 while(1)
 {
 cout<<"要结束商品买入请按\'n\',其它任意键表示继续买入! "<<endl;
 cin>>goon;
 if(goon=='n'||goon=='n')
 break;
 else
 {
 string code;
 unsigned int quantity;
 cout<<"输入要购买的商品代码:"<<endl;
 cin>>code;
 cout<<"输入要购买的数量:"<<endl;
 cin>>quantity;
 sum+=checkout(ptr,code,quantity);
 cout<<"你购买的商品为:"<<endl;
 display_one(ptr,code,quantity);
 }
 }
 cout<<"----------------------------------------------------"<<endl;
 cout<<"你应该付 "<<sum<<"元!"<<endl;
 cout<<"你实际付(元): ";
 cin>>factly;
 cout<<"应该找回你 "<<factly-sum<<"元!"<<endl;//找零。
}


int main()
{
 //---------菜单选项----------------
 link head=null;
 //head=create(head);

 int loop=1;
 while(loop)
 {
 cout<<"***************************************************"<<endl;
 cout<<"*---------------------菜单选项--------------------*"<<endl;
 cout<<"*-------------------------------------------------*"<<endl;
 cout<<"* 1.输入数据 2.买入商品 3.显示数据 0.退出系统 *"<<endl;
 cout<<"***************************************************"<<endl;
 int menu;
 cin>>menu;
 if(cin.fail())
 {
 cout<<"请按菜单对应的数字选择合适的操作,谢谢合作!"<<endl;
 cin.clear();
 fflush(stdin);
 cin>>menu;
 }
 switch(menu)
 {
 case 0:
 cout<<"已退出系统!"<<endl;
 loop=0;
 break;
 case 1:
 head=create(head);
 break;
 case 2:
 total(head);
 break;
 case 3:
 display(head);
 break;
 }//switch(menu)
 }//while(loop)

 //display(head);
 //total(head);
 release(head);
 return 0;
}
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
单选题下列叙述的事件中没有涉及化学变化的是
谚语或格言英文翻译,翻译英语谚语
hpds装好后打开弹出run-time error‘339’
凭直觉判断,谁转过来最漂亮
我国是一个历史悠久的农业大国,但各地农业发
爱而不能在一起的诗句,向闺蜜开玩笑能气死人
我在流水线上干活的干的慢,又干不快,工友老
旭日的近义词是什么
白浪滩游玩的作文100字
农村房子五六间门窗需要多少钱大概的
上海陆家嘴有多少银行,上海海洋大学有哪些专
阅读下面两首古诗,然后回答问题。(5分)舟
怎样辫好看的头发辫子
益阳哪个水果批发市场的水果最便宜
八卦神探薛丹仁5次铜钱用在哪了
推荐资讯
我老公阴部痒红怎么回事
秦朝建立中央集权制度的进步作用,不包括(
你和一只猪赛跑,只有3个选择。一,比猪跑的
下列动物类群中最早起传粉作用的动物是A.蚂蚁
空开跳闸推不上去
水芒芒多少钱一瓶
由于世界杯比赛而引发战争
阿迪达斯SC系列是什么
贫血的症状有哪些?
马自达6车子开起来没力,燃油管内有空气,油
Long long ago, there lived two girls named
黄鳝怎么去骨头视频,一斤活黄鳝去骨去头余多
正方形一边上任一点到这个正方形两条对角线的
阴历怎么看 ?