?? zn3.cpp
字號(hào):
#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
#include"lstack1.h"
#include"lqueue.h"
const int full=10;
LStack1<int>chargestack;
LStack1<int>tempgestack;
LQueue<int>storequeue;
int sell(LStack1<int> &st){
int j=rand()%full;
int temp1;
for(int i=0; i<j; i++){
st.pop(temp1);
}
return j;
}
int addstore(int pd)
{ cout<<"現(xiàn)在倉(cāng)庫(kù)里的貨物數(shù)量少于50件,進(jìn)貨,填滿倉(cāng)庫(kù)"<<"\n";
while(storequeue.length()<80)
{storequeue.enqueue(pd);
pd++;
}
return pd;
}
void addcharge()
{ int temp;
cout<<"現(xiàn)在貨架上的商品數(shù)量少于15件,從倉(cāng)庫(kù)運(yùn)貨"<<"\n";
while(chargestack.length()!=0)
{
chargestack.pop(temp);
tempgestack.push(temp);
}
while(tempgestack.length()<20)
{
storequeue.dequeue(temp);
tempgestack.push(temp);
}
while(chargestack.length()<20)
{
tempgestack.pop(temp);
chargestack.push(temp);
}
}
main()
{
int productdate=1;
int storenumber=80;
productdate=addstore(productdate);
addcharge();
cout<<"\n";
cout<<"今天商店關(guān)門后貨架所剩上的商品的生產(chǎn)日期是"<<"\n";
while(chargestack.play())
{}
cout<<"\n";
cout<<"如果想退出,輸入e"<<" ";
char m;
cin>>m;
while(m!='e')
{
if(chargestack.length()<15)
addcharge();
if(storequeue.length()<50)
productdate=addstore(productdate);
cout<<"\n";
sell(chargestack);
cout<<"今天商店關(guān)門后貨架所剩上的商品的生產(chǎn)日期是"<<"\n";
while(chargestack.play())
{}
cout<<"\n";
cout<<"如果想退出,輸入e"<<" ";
cin>>m;
}
cout<<"\n";
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -