商场电器库存管理系统_第1页
商场电器库存管理系统_第2页
商场电器库存管理系统_第3页
商场电器库存管理系统_第4页
商场电器库存管理系统_第5页
已阅读5页,还剩6页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、商场电器库存管理系统-c+课程设计代码-c+程序设计/main.cpp#include <iostream>#include <string>#include <fstream>#include <cassert>#include <iomanip>#include <conio.h>using namespace std;/仓库管理员类class adminpublic:    admin();private:    string name;/仓库货架类clas

2、s shelfpublic:    shelf();private:    admin men;/管理员    string storeNo;/仓库编号     string kinds;/商品大类    string shelfNo;/货架号;/electrical classclass elepublic:    ele();private:    string name;/商品名&

3、#160;   double price;/介格    shelf sh;/所属货架    long count;/商品数量; /管理(组合类)class manapublic:    mana();    char first_face();/首页    void in_storage();/入库    void out_storage();/ 出库   

4、 void select_ele();/查询    void select_name();/按商品名称查询    void select_price();/按商品价格查询    void select_kind();/按大类查询    void call_break();/商品报损private:    ele aele;    shelf ashelf;    admin abs;/电

5、器类默认构造函数ele:ele():sh()    name = "xxx"/商品名    price = 0.0;/介格    count = 0;/商品数量/仓库货架类默认构造函数shelf:shelf():men()/    storeNo = "xxx"/仓库编号     kinds = "xxx"/商品大类    shelfNo = "x

6、xx"/货架号/仓库管理员类admin:admin()    name = "xxx"/管理类默认构造函数mana:mana():aele(), ashelf(), abs()char mana:first_face()       system("cls");    cout << endl;    cout <<endl <<"tt"&#

7、160;       <<endl <<"tt                                      &#

8、160;       "        <<endl <<"tt          商场电器库存管理系统                "   &

9、#160;    <<endl <<"tt                                         &

10、#160;    "         <<endl <<"tt            1.  商品入库                   

11、60;  "        <<endl <<"tt                                   &#

12、160;          "        <<endl <<"tt            2.  商品出库              

13、;        "        <<endl <<"tt                             

14、0;                "        <<endl <<"tt            3.  查询统计        &

15、#160;             "        <<endl <<"tt                        

16、                      "        <<endl <<"tt            4.  商品报损  

17、60;                   "        <<endl <<"tt                  &#

18、160;                           "             <<endl <<"tt      

19、      5.  退出系统                      "        <<endl <<"tt        

20、60;                                     "        <<endl <<"tt&q

21、uot; <<endl <<endl <<"tt"        return getch();/入库void mana:in_storage()    system("cls");    string name;/商品名    double price;/介格    string storeNo;/仓库编号   

22、0; string kinds;/商品大类    string shelfNo;/货架号    long count = 0; /商品数量        cout << endl << "商品入库,请输入相关信息 : " << endl << endl ;    cout << "t商品名称 : "    cin &g

23、t;> name;    cout << endl << "t商品介格 : "    cin >> price;    cout << endl << "t商品数量 : "    cin >> count;    cout << endl << "t仓库编号 : "  

24、;  cin >> storeNo;    cout << endl << "t商品大类 : "    cin >> kinds;    cout << endl << "t货架编号 : " ;    cin >> shelfNo;        ofstream storeFile(

25、"store.txt", ios:app);    storeFile << setiosflags(ios:left) << setw(20) << name << " "        << setw(15) << price << " " << setw(10) << count << " "

26、        << setw(10) << storeNo << " " << setw(20) << kinds << " "        << shelfNo << endl;    storeFile.close();      &#

27、160; cout << endl << endl << "t该商品已经入库." << endl << endl << "t"    system("pause");/ 出库void mana:out_storage()    system("cls");        string name;/商品名  

28、      cout << endl << "t商品出库,输入出库商品信息 : " << endl << endl;    cout << "t商品名称 : "    cin >> name;        ifstream storeFile("store.txt");   

29、 if (!storeFile)            ofstream storeFile1("store.txt");/      storeFile1.close();        cout << endl << endl << "t仓存为空!" << endl << e

30、ndl << "t"        system("pause");        return;        bool flag = false;    string name1;/商品名    double price1;/介格    string s

31、toreNo1;/仓库编号     string kinds1;/商品大类    string shelfNo1;/货架号    long count1 = 0; /商品数量        ofstream tempFile("temp.txt");        while (storeFile >> name1 >> price1 >

32、> count1 >> storeNo1 >>  kinds1 >> shelfNo1)            if (name1=name)            flag = true;        else    

33、60;           tempFile << setiosflags(ios:left) << setw(20) << name1 << " "            << setw(15) << price1 << " " << setw(10) <

34、< count1 << " "            << setw(10) << storeNo1 << " " << setw(20) << kinds1 << " "            << shelfNo1

35、 << endl;                tempFile.close();    storeFile.close();        if (!flag)            cout << endl << endl <<

36、; "t仓库中没有这种商品!" << endl << endl << "t"        system("pause");        return;            ofstream storeFile1("store.txt"); 

37、;   ifstream tempFile1("temp.txt");    storeFile1 << tempFile1.rdbuf();    storeFile1.close();    tempFile1.close();        cout << endl << "t这些商品已经出库, 请仔细检查!" << endl <

38、;< endl << "t"    system("pause");/查询void mana:select_ele()    while (1)            system("cls");              

39、0; cout << endl << endl;        cout << "t=" << endl            << "t|                

40、;                                         |" << endl      &

41、#160;     << "t|                    商 品 查 询                      

42、;    |" << endl            << "t|                             &

43、#160;                           |" << endl            << "t|     

44、60;          1.  按商品名称查询                       |" << endl            <&

45、lt; "t|                                                

46、         |" << endl            << "t|                2.  按商品价格查询      

47、60;                |" << endl            << "t|                 

48、;                                        |" << endl       &

49、#160;    << "t|                3.  按大类查询                         

50、0; |" << endl            << "t|                                

51、                         |" << endl            << "t|        &#

52、160;       4.  返回                                 |" << endl     

53、0;      << "t|                                         

54、0;               |" << endl            << "t=" << endl << endl << "tt"        char se

55、lect = getch();                switch (select)                case '1':            select_name();

56、            break;        case '2':            select_price();            break;  

57、      case '3':            select_kind();            break;        case '4':      &#

58、160;     return;        default:            break;            /按商品名称查询void mana:select_name()    system("cls");

59、0;   cout << endl << "t按商品名查询 : " << endl << endl ;    cout << "t输入商品名 : "    string name;    cin >> name;    /string name1;/商品名    double price1;/介格 

60、0;  string storeNo1;/仓库编号     string kinds1;/商品大类    string shelfNo1;/货架号    long count1 = 0; /商品数量        ifstream storeFile("store.txt");    if (!storeFile)       

61、     cout << endl << endl << "t对不起,你的库存为空!" << endl << endl << "t"        system("pause");        return;        &

62、#160;   bool flag = false;    cout << endl << "商品名         " << "介格      " << "商品数量  " << "仓库编号    "    &

63、#160;    << "商品大类        " << "货架号" << endl << endl;    while (storeFile >> name1 >> price1 >> count1 >> storeNo1 >>  kinds1 >> shelfNo1)  &

64、#160;         if (name1 = name)                    flag = true;            cout << setiosflags(ios:left) <<

65、setw(15) << name1 << " "                << setw(10) << price1 << " " << setw(10) << count1 << " "        &#

66、160;       << setw(10) << storeNo1 << " " << setw(15) << kinds1 << " "                << shelfNo1 << endl;   

67、60;            storeFile.close();        if (!flag)        cout << endl << endl << "对不起,库存中没有这种商品!"    cout << endl << endl;  

68、;  system("pause");/按商品价格查询void mana:select_price()    system("cls");    cout << endl << "t按商品价格查询 : " << endl << endl ;    cout << "t输入价格 : "    double price;/ 

69、;  cin >> price;        string name1;/商品名    double price1;/介格    string storeNo1;/仓库编号     string kinds1;/商品大类    string shelfNo1;/货架号    long count1 = 0; /商品数量    

70、0;   ifstream storeFile("store.txt");    if (!storeFile)            cout << endl << endl << "t对不起,你的库存为空!" << endl << endl << "t"     

71、   system("pause");        return;            bool flag = false;    cout << endl << "商品名         " << "介格 &

72、#160;    " << "商品数量  " << "仓库编号    "         << "商品大类        " << "货架号" << endl << endl;    while (

73、storeFile >> name1 >> price1 >> count1 >> storeNo1 >>  kinds1 >> shelfNo1)            if (price1 = price)                  &

74、#160; flag = true;            cout << setiosflags(ios:left) << setw(15) << name1 << " "                << setw(10) << price1

75、 << " " << setw(10) << count1 << " "                << setw(10) << storeNo1 << " " << setw(15) << kinds1 << " "  &#

76、160;             << shelfNo1 << endl;                storeFile.close();        if (!flag)        c

77、out << endl << endl << "对不起,库存中没有这个价格的商品!"    cout << endl << endl;    system("pause");/按大类查询void mana:select_kind()    system("cls");    cout << endl << "t按商品大类查询

78、 : " << endl << endl ;    cout << "t输入大类名 : "    string kinds;    cin >> kinds;        string name1;/商品名    double price1;/介格    string storeNo1;/仓库编号  

79、;   string kinds1;/商品大类    string shelfNo1;/货架号    long count1 = 0; /商品数量        ifstream storeFile("store.txt");    if (!storeFile)            cout <&l

80、t; endl << endl << "t对不起,你的库存为空!" << endl << endl << "t"        system("pause");        return;            bool flag = false;

81、    cout << endl << "商品名         " << "介格      " << "商品数量  " << "仓库编号    "         << &qu

82、ot;商品大类        " << "货架号" << endl << endl;    while (storeFile >> name1 >> price1 >> count1 >> storeNo1 >>  kinds1 >> shelfNo1)         

83、   if (kinds1 = kinds)                    flag = true;            cout << setiosflags(ios:left) << setw(15) << name1 << &

84、quot; "                << setw(10) << price1 << " " << setw(10) << count1 << " "              

85、  << setw(10) << storeNo1 << " " << setw(15) << kinds1 << " "                << shelfNo1 << endl;          

86、      storeFile.close();        if (!flag)        cout << endl << endl << "对不起,库存中没有这类商品!"    cout << endl << endl;    system("pause");

87、/商品报损void mana:call_break()    system("cls");/   string name;/商品名        cout << endl << "t商品报损,请输入要报损商品信息 : " << endl << endl;    cout << "t商品名称 : "    ci

88、n >> name;        ifstream storeFile("store.txt");    if (!storeFile)            ofstream storeFile1("store.txt");        storeFile1.close();

89、60;       cout << endl << endl << "t仓存为空!" << endl << endl << "t"        system("pause");        return;      

90、;      bool flag = false;    string name1;/商品名    double price1;/介格    string storeNo1;/仓库编号     string kinds1;/商品大类    string shelfNo1;/货架号    long count1 = 0; /商品数量     

91、;   ofstream tempFile("temp.txt");    cout << endl << endl << "你想报损商品信息如下 : " << endl << endl;    cout << endl << "商品名         " << "介格&#

92、160;     " << "商品数量  " << "仓库编号    "         << "商品大类        " << "货架号" << endl << endl;   

93、60;      while (storeFile >> name1 >> price1 >> count1 >> storeNo1 >>  kinds1 >> shelfNo1)            if (name1=name)             

94、;       flag = true;            cout << setiosflags(ios:left) << setw(15) << name1 << " "                &

95、lt;< setw(10) << price1 << " " << setw(10) << count1 << " "                << setw(10) << storeNo1 << " " << setw(15) << kinds1 <

96、< " "                << shelfNo1 << endl;            shelfNo1 += "(损坏)"                tempFile << setiosflags(ios:left) << setw(20) << name1 << " "

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论