1、 Push a button to get a list displayed of all the items and their quantities in the inventory. 3. Push a button to take the next (top) item from inventory and put it in a shipping queue.4. Push a button to get a list displayed of all the items that are currently shipping.5. Push a button to indicate
2、 that a shipped item has been delivered and should be taken out of the shipping queue. Shipped items are put in and taken out FIFO.6. Push a button to display all the things that have been delivered.You are to create classes for the different data structures and nodes. You also need a driver program
3、 that takes user input and manipulates a node object and prints output. The driver should be written as a C+ application with buttons and text input and output.One way to do the application is to have two text fields for input, a text area for output, and buttons that say “add to inventory,” “displa
4、y inventory,” etc. Think about your design and draw it out before you write the code. Also, draw your data structures before you write any code. Draw out the operations of taking things from one data structure and putting them into another. Think about what goes in your application and your class be
5、fore you write any code.三、实验过程或算法(源程序)本组由王福临(20115394)、陈云艳(20115351)和许文丽(20115352)组成。许文丽负责课程设计的界面设计,以及最终的实验报告填写等总结部分,所进行的工作占总工作量的30%;陈云艳负责课程设计的几个基本类的具体功能的实现和出错处理部分,所进行的工作占总工作量的30%;王福临负责课程设计的界面设计内部的与功能相关的进货,出货以及卖货的综合函数的实现部分,所进行的工作占总工作量的40%。1:我们选用的是窗体应用程序来做这一个项目.2:许文丽同学设计的界面如下:整个实现一共有六个按钮,分别管理货物的入库,库存
6、货品的展示,货物的出库,出库货品的展示,货物的出售以及出售货物的展示。程序的主要进程如下:(1):用户点击按钮,把货物存入仓库;(2):点击按钮,展示所有仓库中的货物;(3):点击按钮,将货物的一部分从仓库中取出来;(4)展示所有的取出的货物;(5)将提出的货物一件件的卖出;(6)展示(记录)所有卖出的货物。3:类的具体功能的实现这些类的基本功能:为各个按钮的实现做基础,首先,我们需要用到类模板,那么就需要一个基类来作为我们的实例化对象;其次,对仓库中货物的操作其实本质上是对栈和队列中的数据元素的插入,删除的操作,所以首先要实现几个基本类的实现。node.h#pragma once#inclu
7、deusing namespace std;class node private: string h; int s; string d;public: node(void); void set(int a,string b,string c); node operator+(node&); bool operator=(node& int shu(); node(node &N) h=N.h; s=N.s; d=N.d; string huo(); string dan(); node(void);Node.cpp#include StdAfx.hnode.hnode:node(void) h
8、=; s=-1; d=void node:set(int a,string b,string c) s=a;h=b;d=c;string node:huo() return h;int node:shu() return s;dan() return d;node node:operator+(node&N) this-s=this-s+N.s; return *this;bool node:operator=(node& if (this-h=N.h)return 1;else return 0;node(void)Aquue.h#define Defaultsize 200template
9、 class Aquue int size; int front; int rear; T *listArray; Aquue(void) size=Defaultsize+1; rear=0; front=1; listArray=new Tsize; Aquue() delete listArray; void clear() front=rear; bool enqueue(const T &it) if (rear+2)%size=front) return false; rear=(rear+1)%size; listArrayrear=it; return true; bool d
10、equeue(T & if (length()=0)return false; it=listArrayfront; front=(front+1)%size; return true; bool frontValue(T & it)const if (length()=0) return false; virtual int length() const return (rear+size)-front+1)%size; ;Astack.h#define DefaultListSize 200templateclass Astack int top; Astack(void) size=De
11、faultListSize;top=0;listArray=new Tsize; Astack(Astack &sta) size=sta.size; top=sta.top; for(int i=0;i#includeAquue.hAstack.hForm2.h报馈?错洙?h出?啦?.hnamespace Project1 using namespace System; using namespace System:ComponentModel;Collections;Windows:Forms;Data;Drawing;Runtime:InteropServices; public ref
12、 class Form1 : public System:Forms:Form public: Form1(void) InitializeComponent(); a=new Aquue(); n=new Astack r=new Aquue protected: Form1() if(a) delete a; if(n) delete n; if (components) delete components; private: System:Button button1;TextBox textBox1;TextBox textBox2;Button button2;Label label
13、1;Label label2;TextBox textBox4;Label label3;RichTextBox richTextBox1;Label label4;Button button3;TextBox textBox3;TextBox textBox5;TextBox textBox6;Label label5;Label label6;Label label7;RichTextBox richTextBox2;Button button4;Label label8;Button button5;TextBox textBox7;TextBox textBox8;TextBox te
14、xtBox9;Label label9;Label label10;Label label11;Button button6;RichTextBox richTextBox3;Label label12; Aquue *a; Astack *n; AquueText).ToPointer(); string s1=ch1; Marshal:FreeHGlobal(IntPtr(void*)ch1); int flag=0; const char *ch2=(const char*)(Marshal:StringToHGlobalAnsi(textBox2- for(int i=0;ch2i!=
15、0 if(ch2i9|ch2iset1(please give the right messageShow(); return; else bbb=atoi(ch2);FreeHGlobal(IntPtr(void*)ch2); const char *ch3=(const char*)(Marshal:StringToHGlobalAnsi(textBox4- string s3=ch3;FreeHGlobal(IntPtr(void*)ch3); node no; no.set(bbb,s1,s3); n-push(no); textBox1-Text=L textBox2- textBo
16、x4-(2)库存显示:由于进货入库是一个一对一的操作,如果用户不记得自己到底进了那些货,多少货,那么只需要点击“仓库货物展示”按钮就可以看到仓库中所有的有序排列的货物。如下所示:其实就是将上一入库中所接受的货物从栈中pop出来,但值得注意的是不能对栈本身操作,而是要将其复制,这样才不会使得原来栈中元素全无,再者就是不会导致每点击一次库存展示它的顺序就颠倒一次,这样显然不符合我们用栈的初衷,所以才需要用到拷贝构造函数对其复制品进行操作。Void button2_Click(System: node it; Astack *d; d=new Astackpop(it) int aa,bb; str
17、ing name= string sss= string danwei= name=it.huo(); aa=it.shu(); danwei=it.dan(); while(aa) bb=aa%10; aa=aa/10; sss=char(bb+48)+sss; st=st+name+ +sss+danwei+n String ss=gcnew String(st.c_str(); richTextBox1-Text=ss; delete ss; delete d;(3)出库:a.现在要提货了,即本质上是从栈中拿货,这样就是对栈的一些操作了,注意我们这里并没有将不同时间进来的相同的货物数量加在一起,为了保持栈的本质不变,所以提货的时候也要保持原来货物的顺序不改变,只是将货物的数量减少而已,调试结果如下所示:(提货前)(提货后)B.另外,还必须考虑的一个问题是,万一我事先不知道或者不是进货本人来提货的时候,可能会出现所提的货不在仓库之中,因此我们需要为其提供一个报错框,来提示用户仓库中无此货,如下所示:C.那么,如果库存商品没有我们想要的那么多呢,这是有需要进行报错处理,如下;Void button3_Click(System: int am; const char *ch=(const char
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1