C++實(shí)現(xiàn)智能柜管理系統(tǒng)_第1頁
C++實(shí)現(xiàn)智能柜管理系統(tǒng)_第2頁
C++實(shí)現(xiàn)智能柜管理系統(tǒng)_第3頁
C++實(shí)現(xiàn)智能柜管理系統(tǒng)_第4頁
C++實(shí)現(xiàn)智能柜管理系統(tǒng)_第5頁
已閱讀5頁,還剩26頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

第C++實(shí)現(xiàn)智能柜管理系統(tǒng)本文實(shí)例為大家分享了C++實(shí)現(xiàn)智能柜管理系統(tǒng)的具體代碼,供大家參考,具體內(nèi)容如下

#define_CRT_SECURE_NO_DEPRECATE

#includeiostream

#includestdlib.h

#includefstream

#includecstdlib

#includectime

#includestring

usingnamespacestd;

structNode

intpcode;

intnum;

stringpnum;

time_ttnum;

Node*next;

Node*prev;

//取件成功+剩余提示

voidrreaction(intl){

cout"______________________________________________________________";

coutendl;

coutendl;

cout"

取件成功?。?!";

coutendl;

cout"______________________________________________________________";

coutendl;

system("pause");

system("cls");

if(l!=0){

cout"______________________________________________________________";

coutendl;

coutendl;

cout"

當(dāng)前手機(jī)號(hào)還有"l"件未?。。?!";

coutendl;

cout"______________________________________________________________";

coutendl;

system("pause");

system("cls");

}

//取件碼錯(cuò)誤

voidfreaction(){

cout"______________________________________________________________";

coutendl;

coutendl;

cout"

取件碼錯(cuò)誤!?。?;

coutendl;

cout"______________________________________________________________";

coutendl;

system("pause");

system("cls");

//取件系統(tǒng)

intpcode(){

intj=0;

intl=0;

intlist1[25];

intlist2[25];

stringlist3[25];

intlist4[25];

ifstreamfile1("num.txt");

ifstreamfile2("tnum.txt");

ifstreamfile3("pnum.txt");

ifstreamfile4("pcode.txt");

while(file1.peek()!=EOF){

file1list1[j];

file2list2[j];

file3list3[j];

file4list4[j++];

}

file1.close();

file2.close();

file3.close();

file4.close();

intpcode;

cout"______________________________________________________________";

coutendl;

coutendl;

cout"

取件碼:";cinpcode;

coutendl;

cout"______________________________________________________________";

for(inti=0;ij-1;i++){

if(list4[i]==pcode){

ofstreamfile1;

file1.open("num.txt");

ofstreamfile2;

file2.open("tnum.txt");

ofstreamfile3;

file3.open("pnum.txt");

ofstreamfile4;

file4.open("pcode.txt");

for(intk=0;kj-1;k++){

if(k==i)continue;

else{

if(list3[i]==list3[k])l=l+1;

file1list1[k]endl;

file2list2[k]endl;

file3list3[k]endl;

file4list4[k]endl;

}

}

file1.close();

file2.close();

file3.close();

file4.close();

system("cls");

cout"______________________________________________________________";

coutendl;

coutendl;

cout"

柜號(hào)"list1[i]"已打開";

coutendl;

cout"______________________________________________________________";

coutendl;

system("pause");

system("cls");

returnl;

}

}

system("cls");

return-1;

//快遞員取件

Node*dnode(Node*head,intn){

Node*p0;

p0=head;

while(p0-prev!=NULL){

if(p0-num==n){

if(p0==head){

head=head-prev;

deletep0;

returnhead;

}

else{

p0-prev-next=p0-next;

p0-next-prev=p0-prev;

deletep0;

returnhead;

}

}

p0=p0-prev;

if(p0-prev==NULL)

{

cout"______________________________________________________________";

coutendl;

coutendl;

cout"

柜號(hào)"n"為空!!!";

coutendl;

cout"______________________________________________________________";

coutendl;

system("pause");

system("cls");

returnhead;

}

}

returnhead;

//柜子界面

intginformation(Node*head){

Node*p0;

p0=head;

intj=1;

intn;

intm[26]={0};

while(p0-prev!=NULL){

m[p0-num]=1;

p0=p0-prev;

}

cout"_________________________________________________________________________________________________________________________"endl;

cout"|

1

|

2

|

3

|

4

|

5

|"endl;

cout"|

";if(m[j]==0){j++;cout"---

";}

else{j++;cout"已存放";}cout"

|

";if(m[j]==0){j++;cout"---

";}

else{j++;cout"已存放";}cout"

|

";if(m[j]==0){j++;cout"---

";}

else{j++;cout"已存放";}cout"

|

";if(m[j]==0){j++;cout"---

";}

else{j++;cout"已存放";}cout"

|

";if(m[j]==0){j++;cout"---

";}

else{j++;cout"已存放";}cout"

|"endl;

cout"|_______________________|_______________________|_______________________|_______________________|_______________________|"endl;

cout"|

6

|

7

|

8

|

9

|

10

|"endl;

cout"|

";if(m[j]==0){j++;cout"---

";}

else{j++;cout"已存放";}cout"

|

";if(m[j]==0){j++;cout"---

";}

else{j++;cout"已存放";}cout"

|

";if(m[j]==0){j++;cout"---

";}

else{j++;cout"已存放";}cout"

|

";if(m[j]==0){j++;cout"---

";}

else{j++;cout"已存放";}cout"

|

";if(m[j]==0){j++;cout"---

";}

else{j++;cout"已存放";}cout"

|"endl;

cout"|_______________________|_______________________|_______________________|_______________________|_______________________|"endl;

cout"|

11

|

12

|

13

|

14

|

15

|"endl;

cout"|

|

|

|

|

|"endl;

cout"|

";if(m[j]==0){j++;cout"---

";}

else{j++;cout"已存放";}cout"

|

";if(m[j]==0){j++;cout"---

";}

else{j++;cout"已存放";}cout"

|

";if(m[j]==0){j++;cout"---

";}

else{j++;cout"已存放";}cout"

|

";if(m[j]==0){j++;cout"---

";}

else{j++;cout"已存放";}cout"

|

";if(m[j]==0){j++;cout"---

";}

else{j++;cout"已存放";}cout"

|"endl;

cout"|

|

|

|

|

|"endl;

cout"|_______________________|_______________________|_______________________|_______________________|_______________________|"endl;

cout"|

16

|

17

|

18

|

19

|

20

|"endl;

cout"|

|

|

|

|

|"endl;

cout"|

";if(m[j]==0){j++;cout"---

";}

else{j++;cout"已存放";}cout"

|

";if(m[j]==0){j++;cout"---

";}

else{j++;cout"已存放";}cout"

|

";if(m[j]==0){j++;cout"---

";}

else{j++;cout"已存放";}cout"

|

";if(m[j]==0){j++;cout"---

";}

else{j++;cout"已存放";}cout"

|

";if(m[j]==0){j++;cout"---

";}

else{j++;cout"已存放";}cout"

|"endl;

cout"|

|

|

|

|

|"endl;

cout"|_______________________|_______________________|_______________________|_______________________|_______________________|"endl;

cout"|

21

|

22

|

23

|

24

|

25

|"endl;

cout"|

|

|

|

|

|"endl;

cout"|

|

|

|

|

|"endl;

cout"|

";if(m[j]==0){j++;cout"---

";}

else{j++;cout"已存放";}cout"

|

";if(m[j]==0){j++;cout"---

";}

else{j++;cout"已存放";}cout"

|

";if(m[j]==0){j++;cout"---

";}

else{j++;cout"已存放";}cout"

|

";if(m[j]==0){j++;cout"---

";}

else{j++;cout"已存放";}cout"

|

";if(m[j]==0){j++;cout"---

";}

else{j++;cout"已存放";}cout"

|"endl;

cout"|

|

|

|

|

|"endl;

cout"|

|

|

|

|

|"endl;

cout"|_______________________|_______________________|_______________________|_______________________|_______________________|"endl;

coutendl"

輸入要取出的智能柜的編號(hào)(輸入'0'返回):";

cinn;

switch(n){

case1:

case2:

case3:

case4:

case5:

case6:

case7:

case8:

case9:

case10:

case11:

case12:

case13:

case14:

case15:

case16:

case17:

case18:

case19:

case20:

case21:

case22:

case23:

case24:

case25:

system("cls");

returnn;

case0:

system("cls");

returnn;

default:

system("cls");

return-1;

}

//初始化

Node*init()

Node*head;

head=newNode;

head-next=NULL;

head-prev=NULL;

returnhead;

Node*autoinput(Node*head){

intj=0;

intlist1[25];

intlist2[25];

stringlist3[25];

intlist4[25];

ifstreamfile1("num.txt");

ifstreamfile2("tnum.txt");

ifstreamfile3("pnum.txt");

ifstreamfile4("pcode.txt");

while(file1.peek()!=EOF){

file1list1[j];

file2list2[j];

file3list3[j];

file4list4[j++];

}

file1.close();

file2.close();

file3.close();

file4.close();

for(inti=0;ij-1;i++){

Node*p0,*p1;

p0=head;

p1=newNode;

p1-num=list1[i];

p1-tnum=list2[i];

p1-pnum=list3[i];

p1-pcode=list4[i];

p1-prev=p0;

p0-next=p1;

p1-next=NULL;

head=p1;

}

returnhead;

//柜滿警告

voidserror(Node*head){

system("cls");

cout"____________________________________________________________________________________";

coutendl;

coutendl;

cout"

無可用的柜子!??!";

coutendl;

cout"____________________________________________________________________________________";

coutendl;

system("pause");

system("cls");

//派送快遞

intsedelivery(Node*head){

intlist[25];

inti=0;

intk=0;

Node*p0,*p1,*p2;

p0=head;

p2=head;

p1=newNode;

while(p2-prev!=NULL){

list[i]=p2-

p2=p2-prev;

i++;

}

stringsize,pnum;

unsignedseed;

time_tnow=time(0);

seed=time(0);

srand(seed);

cout"____________________________________________________________________________________";

coutendl;

coutendl;

cout"

包裹大小(small|medium|large):";cinsize;

coutendl;

coutendl;

cout"

手機(jī)號(hào)碼:";cinpnum;

coutendl;

cout"____________________________________________________________________________________";

coutendl;

if(pnum.length()!=11){

cout"

請輸入正確的手機(jī)號(hào)碼?。?!";

coutendl;

system("pause");

system("cls");

return-1;

}

elsep1-pnum=pnum;

if(size=="small"){

intj=1;

for(;j=10;j++){

for(;kk++){

if(k==i){

p1-num=j;

break;

}

if(j==list[k]){

k=0;

break;

}

}

if(k!=0)break;

}if(j==11)return0;

}

elseif(size=="medium"){

intj=11;

for(;j=20;j++){

for(;kk++){

if(k==i){

p1-num=j;

break;

}

if(j==list[k]){

k=0;

break;

}

}

if(k!=0)break;

}if(j==21)return0;

}

elseif(size=="large"){

intj=21;

for(;j=25;j++){

for(;kk++){

if(k==i){

p1-num=j;

break;

}

if(j==list[k]){

k=0;

break;

}

}

if(k!=0)break;

}if(j==26)return0;

}

else{

cout"

請輸入正確的包裹大小?。。?;

coutendl;

system("pause");

system("cls");

return-1;

}

p1-tnum=now;

p1-pcode=rand();

p1-prev=p0;

p0-next=p1;

p1-next=NULL;

head=p1;

cout"

派送成功?。?!";

coutendl;

cout"

包裹將投放到"p1-num"號(hào)柜";

coutendl;

system("pause");

system("cls");

return1;

//超時(shí)快遞

intiexpress(Node*head){

intn;

unsignedseed;

time_tnow=time(0);

seed=time(0);

srand(seed);

Node*p0,*p1;

p0=head;

while(p0-prev-prev!=NULL)p0=p0-prev;

p1=p0;

while(p0!=NULL){

if(p0-tnum+86400=now){

char*dt=ctime(p0-tnum);

cout"____________________________________________________________________________________";

coutendl;

coutendl;

cout"

柜號(hào):"p0-numendl;

cout"

時(shí)間:"dtendl;

cout"

手機(jī)號(hào)碼:"p0-pnum;

coutendl;

cout"____________________________________________________________________________________";

coutendl;

}

elsebreak;

p0=p0-next;

}

coutendl"

輸入要重放的智能柜的編號(hào)(輸入'0'返回):";

cinn;

if(n==0);

else{

while(p1!=NULL){

if(p1-tnum+86400=now){

if(p1-num==n){

if(p1==head){

p1-tnum=now;

p1-pcode=rand();

coutendl"

操作成功?。?!";

coutendl;

coutendl;

system("pause");

system("cls");

return1;

}

else{

p1-prev-next=p1-next;

p1-next-prev=p1-prev;

p1-tnum=now;

p1-pcode=rand();

p1-prev=head;

head-next=p1;

p1-next=NULL;

coutendl"

操作成功?。。?;

coutendl;

coutendl;

system("pause");

system("cls");

return2;

}

}

}

else{

coutendl"

操作失?。。?!";

coutendl;

coutendl;

system("pause");

system("cls");

return1;

}

p1=p1-next;

}

}

system("cls");

return1;

//文件輸出

voidiinformation(Node*head){

intj=0;

Node*p0;

p0=head;

intlist1[25];

intlist2[25];

stringlist3[25];

intlist4[25];

while(p0-prev!=NULL){

list1[j]=p0-

list2[j]=p0-tnum;

list3[j]=p0-pnum;

list4[j++]=p0-pcode;

p0=p0-prev;

}

ofstreamfile1;

file1.open("num.txt");

ofstreamfile2;

file2.open("tnum.txt");

ofstreamfile3;

file3.open("pnum.txt");

ofstreamfile4;

file4.open("pcode.txt");

for(j=j-1;j){

file1list1[j]endl;

file2list2[j]endl;

file3list3[j]endl;

file4list4[j--]endl;

}

file1.close();

file2.close();

file3.close();

file4.close();

//快遞員系統(tǒng)界面

intinitialization(Node*head){

intn;

cout"____________________________________________________________________________________"endl;

cout"|

|"endl;

cout"|

智能柜管理系統(tǒng)

|"endl;

cout"|

|"endl;

cout"|

1.取出快遞

|"endl;

cout"|

|"endl;

cout"|

2.放置快遞

|"endl;

cout"|

|"endl;

cout"|

3.查詢超時(shí)快遞

|"endl;

cout"|

|"endl;

cout"|

0.注銷

|"endl;

cout"|

|"endl;

cout"|__________________________________________________________________________________|"endl;

coutendl"

輸入對應(yīng)數(shù)字進(jìn)入相應(yīng)功能:";

cinn;

switch(n){

case1:

system("cls");

return1;

case2:

system("cls");

return2;

case3:

system("cls");

return3;

case0:

system("cls");

return0;

default:

system("cls");

return-1;

}

//登錄錯(cuò)誤提示

voidlerror(){

cout"____________________________________________________________________________________";

coutendl;

coutendl;

cout"

賬號(hào)或密碼錯(cuò)誤?。?!";

coutendl;

coutendl;

cout"____________________________________________________________________________________";

coutendl;

system("pause");

system("cls");

//登錄系統(tǒng)

intlsystem(){

intj=0;

intanumber;

intpassword;

intlist1[10];

intlist2[10];

ifstreamfile1("anumber.txt");

while(!file1.eof())

file1list1[j++];

file1.close();

j=0;

ifstreamfile2("password.txt");

while(!file2.eof())

file2list2[j++];

file2.close();

cout"____________________________________________________________________________________";

coutendl;

coutendl;

cout"

賬號(hào):";cinanumber;

coutendl;

coutendl;

cout"

密碼:";cinpassword;

coutendl;

cout"____________________________________________________________________________________";

for(inti=0;ii++){

if(list1[i]==anumberlist2[i]==password){

system("cls");

return1;

}

else{

system("cls");

return-1;

}

}

return-1;

//系統(tǒng)界面

intlinterface(){

intn;

cout"____________________________________________________________________________________"endl;

cout"|

|"endl;

cout"|

智能柜管理系統(tǒng)

|"endl;

cout"|

|"endl;

cout"|

1.取快遞

|"endl;

cout"|

|"endl;

cout"|

2.快遞員登錄

|"endl;

cout"|

|"endl;

cout"|

0.退出

|"endl;

cout"|

|"endl;

cout"|__________________________________________________________________________________|"endl;

coutendl"

輸入對應(yīng)數(shù)字進(jìn)入相應(yīng)功能:";

cinn;

switch(n){

case1:

system("cls");

return1;

case2:

system("cls");

return2;

case0:

exit(1);

default:

system("cls");

return-1;

}

n為系統(tǒng)界面返回值

1為取件系統(tǒng)

2為快遞員登錄系統(tǒng)界面

-1為循環(huán)

m為取件系統(tǒng)返回值

-1為取件失敗

其他為取件成功

j為登錄系統(tǒng)返回值

1為登陸成功

-1為登錄失敗

k為快遞員系統(tǒng)界面返回值

1為柜子界面

2為派送快

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論