小商品管理系统mysql实现

编程入门 行业动态 更新时间:2024-10-27 22:20:31

小商品<a href=https://www.elefans.com/category/jswz/34/1769858.html style=管理系统mysql实现"/>

小商品管理系统mysql实现

假设某商店有如下几种货品:衬衣、帽子、立柜。每一种货物都有与其关联的说明信息。

衬衣:单价、产地、布料;

帽子:单价、产地、布料、样式(平顶或尖顶);

立柜:单价、产地、木料、颜色。

对这些商品的操作有:商品的进库(增加某类商品及其库存量),商品的出库(减少某类商品及其库存量),某类货品总价格的计算。

要求自行设计数据结构,用类的继承与派生关系将上述的各种货品表示出来,并使用类的构造函数来初始化每一类对象的初始数据。而后将上述的商品管理计算机化,完成操作要求的功能。

二、实验过程(实验步骤、记录、数据、)

#include

#include

using namespace std;

class Shirt

{

public:

Shirt(double p=21,int n=21,string a="江西",string c="棉质"):price(p),num(n),area(a),cloth(c){}

friend Shirt operator + (Shirt &sh,int a);

Shirt operator - (int a);

void input();

void output();

void change();

double sum();

double price;

int num;

string area;

string cloth;

};

class Hat:public Shirt

{

public:

Hat(double p=21,int n=21,string a="江西",string c="棉质",string h="平顶"):Shirt(p,n,a,c),stytle(h){}

friend Hat operator + (Hat &h1,int a);

Hat operator - (int a);

void input();

void output();

void change();

// double sum();

string stytle;

};

class Closet :public Shirt

{

public:

Closet(double p=21,int n=21,string a="江西",string c="白桦",string h="紫色"):Shirt(p,n,a,c),tree(c),colour(h){}

void input();

void output();

// double sum();

void change();

string tree;

string colour;

};

double Shirt::sum()

{

return num*price;

}

void Shirt::input()

{

cout<

cin>>price;

cout<

cin>>num;

cout<

cin>>area;

cout<

cin>>cloth;

}

void Shirt::output()

{

cout<

cout<

cout<

cout<

}

void Hat::input()

{

cout<

cin>>price;

cout<

cin>>num;

cout<

cin>>area;

cout<

cin>>cloth;

cout<

cin>>stytle;

}

void Hat::output()

{

cout<

cout<

cout<

cout<

cout<

}

void Closet::input()

{

cout<

cin>>price;

cout<

cin>>num;

cout<

cin>>area;

cout<

cin>>tree;

cout<

cin>>colour;

}

void Closet::output()

{

cout<

cout<

cout<

cout<

cout<

}

void Change(Shirt &s1,Hat &h1,Closet &c1)

{

int a;

cout<

cout<

cin>>a;

switch(a)

{

case 1: s1.change();break;

case 2:h1.change();break;

case 3:c1.change();break;

}

}

void Shirt::change()

{

string c,c1;int a;

cout<

cin>>c;

if(c=="单价")

{cout<>price;cout<

else if (c=="数量")

{

cout<>c1;

if(c1=="增加")

{cout<>a;num=num+a;cout<

else if(c1=="减少")

{cout<>a;num=num-a;cout<

}

else if(c=="产地")

{cout<>area;cout<

else if(c=="布料")

{cout<>cloth;cout<

}

void Hat::change()

{

string c,c1;int a;

cout<>c;

if(c=="单价")

{cout<>price;cout<

else if (c=="数量")

{

cout<>c1;

if(c1=="增加")

{cout<>a;num=num+a;cout<

else if(c1=="减少")

{cout<>a;num=num-a;cout<

}

else if(c=="产地")

{cout<>area;cout<

else if(c=="布料")

{cout<>cloth;cout<

else if(c=="样式")

{cout<>stytle;cout<

}

void Closet::change()

{

string c,c1;int a;

cout<>c;

if(c=="单价")

{cout<>price;cout<

else if (c=="数量")

{

cout<>c1;

if(c1=="增加")

{cout<>a;num=num+a;cout<

else if(c1=="减少")

{cout<>a;num=num-a;cout<

}

else if(c=="产地")

{cout<>area;cout<

else if(c=="布料")

{cout<>tree;cout<

else if(c=="颜色")

{cout<>colour;cout<

}

void Sum(Shirt &s1,Hat &h1,Closet &c1)

{

cout<

s1.output();

h1.output();

c1.output();

cout<

cout<

cout<

}

int main()

{

Shirt  s1,s2;

Hat  h1,h2;

Closet c1,c2;

char c;system("pause");

system("mode con cols=90 lines=40");

system("title 小商品管理");

system("color  85");

s1.output();h1.output();c1.output();

cout<

cin>>c;system("cls");system("pause");

while(c=='Y')

{

Change(s1,h1,c1);

cout<

cin>>c;system("cls");system("pause");

}

cout<>c;system("cls");system("pause");

if(c=='Y')

{

Sum(s1,h1,c1);

}

return 0;

}

更多推荐

小商品管理系统mysql实现

本文发布于:2024-03-15 11:31:23,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1738792.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:管理系统   小商品   mysql

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!