物資管理系統(tǒng)代碼_第1頁
物資管理系統(tǒng)代碼_第2頁
物資管理系統(tǒng)代碼_第3頁
物資管理系統(tǒng)代碼_第4頁
物資管理系統(tǒng)代碼_第5頁
已閱讀5頁,還剩33頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡介

#include<iostream>#include<string>#include<fstream>#include<cassert>#include<iomanip>usingnamespacestd;#include<conio.h>//getch()#defineMAX50inttotal_in=0;inttotal_out=0;classin;classout;classgoods//貨物類{public:stringno; //編號stringgname; //名稱stringunit; //單位stringstandards; //規(guī)格stringbrand; //品牌stringproducetime;//生產(chǎn)日期doubleprice; //價格stringEXP; //保質(zhì)期///貨物類構(gòu)造函數(shù)brand1,stringgoods(stringno1,stringgname1,stringunit1,stringstandards1,stringproducetime1,doubleprice1,stringEXP1)brand1,string{no=no1;gname=gname1;unit=unit1;standards=standards1;brand=brand1;producetime=producetime1;price=price1;EXP=EXP1;}};classin:virtualpublicgoods //入庫類{public:intcount_in; //數(shù)量stringtime_in; //入庫時間in*next; //指向自身的指針/////入庫類構(gòu)造函數(shù)in(stringno1,stringgname1,stringunit1,stringstandards1,stringbrand1,stringproducetime1,doubleprice1,stringEXP1,intcount_in1,stringtime_in1):goods(no1,gname1,unit1,standards1,brand1,producetime1,price1,EXP1){count_in=count_in1;time_in=time_in1;}};classout:virtualpublicgoods//出庫類{public:intcount_out; //數(shù)量out*next; //指向自身的指針stringtime_out; //出庫時間/////出庫類構(gòu)造函數(shù)out(stringno1,stringgname1,stringunit1,stringstandards1,stringbrand1,stringproducetime1,doubleprice1,stringEXP1,intcount_out1,stringtime_out1):goods(no1,gname1,unit1,standards1,brand1,producetime1,price1,EXP1){count_out=count_out1;time_out=time_out1;}};classcode//密碼類{public:stringcode1;code(stringcode2){code1=code2;}};classmanager:publicin,publicout{public:intfirst_face();//voidchoose_face1();//voidchoose_face2();//voidchoose_face3();//intadmin_face();//首頁intcommon_face();//voidgoods_in(); //入庫函數(shù)

voidgoods_in1();voidgoods_out();voidenter();voidselect();voidselect_no();voidselect_gname();voidselect_all();voidselect_out();voidmodify();voidprint();voidadd_price();voidadd_count();intpass();voidm_gname();voidm_standards();voidm_unit();//已有商品入庫//已有商品入庫//出庫函數(shù)//修改密碼函數(shù)//查詢//按編號查詢//按名稱查詢//查詢所有信息//查詢出庫信息//修改頁面函數(shù)//按價格排序函數(shù)//統(tǒng)計庫存商品總價格//統(tǒng)計庫存商品總量//密碼登錄函數(shù)//修改商品名稱//修改商品規(guī)格//修改商品單位//修改商品品牌voidm_producetime();//修改商品生產(chǎn)日期voidm_EXP();voidm_price();voidlist_in();voidlist_out();voidwrite();//修改商品保質(zhì)期//修改商品價格//商品入庫從文件讀數(shù)據(jù)到內(nèi)存生成鏈表//商品出庫從文件讀數(shù)據(jù)到內(nèi)存生成鏈表//將鏈表寫入文件manager(stringno1,stringgname1,stringunit1,stringstandards1,stringbrand1,stringproducetime1,doubleprice1,stringEXP1,intcount_in1,stringtime_in1,intcount_out1,stringtime_out1):goods(no1,gname1,unit1,standards1,brand1,producetime1,price1,EXP1),in(no1,gname1,unit1,standards1,brand1,producetime1,price1,EXP1,count_in1,time_in1),out(no1,gname1,unit1,standards1,brand1,producetime1,price1,EXP1,count_out1,time_out1){}};in*head1=NULL;//入庫商品鏈表頭指針out*head2=NULL;//出庫商品鏈表頭指針//修改密碼voidmanager::enter(){system("cls");stringcode1,code2;cout<<endl<<" 歡迎修改密碼! "<<endl;ofstreamfout("D:\\code.txt");if(!fout)coutvv” 文件打不開!”vvendl;return;}coutvvendlvv"\t\t請輸入舊密碼:";cin>>code1;coutvvendlvv"\t\t請輸入新密碼:";cin>>code2;fout<<code2;coutvvendlvv"\t\t您新設(shè)的密碼是:"vvcode2vvendl;coutvvendlvv"\t\t密碼修改完成,按任意鍵繼續(xù)。。。。。"vvendl;system("pause");}stringgetPW(charpwCh='*'){constintlength=18;//最大密碼長度=18charpass[length]={0};for(inti=0;ivlength-1;i++){pass[i]=getch();if(pass[i]=='\r'){pass[i]=0;coutvvendl;returnstring(pass);}coutvvpwCh;}coutvvendl;returnstring(pass);}//登錄函數(shù)intmanager::pass(){stringpass1,pass2,pass3;inti=0;ifstreamfin("D:\\code.txt");if(!fin){system("cls");do{system("cls");stringpass("123");cout<<endl;cout<<"\t\t"<<endl;coutvvendlvv"\t您選擇的是管理員登陸,需要輸入密碼!"vvendl;coutvvendlvv"\t這是您第"vvi+lvv"次輸入!"vvendl;coutvvendlvv"\t請輸入密碼(可以輸入三次,當(dāng)前試用密碼為“123”):";if(!pare(getPW())){choose_face2();return0;}else{coutvvendlvv"\t密碼錯誤,請重新輸入!\n"<<endl;system("pause");i++;////錯誤次數(shù)計數(shù)}}while(i<3);if(i==3){coutvvendlvv"\t密碼三次錯誤,退出系統(tǒng)!"vvendl;exit(0);}}fin>>pass2;pass3=pass2;do{system("cls");cout<<endl<<"\t\t"<<endl;coutvvendlvv"\t您選擇的是管理員登陸,需要輸入密碼!"<<endl;coutvvendlvv"\t這是您第"vvi+lvv"次輸入!"vvendl;coutvvendlvv"\t請輸入修改后的密碼(可以輸入三次):";if(!pare(getPW())){choose_face2();return0;}else{coutvvendlvv"\t密碼錯誤,請重新輸入!\n"vvendl;system("pause");i++;////錯誤次數(shù)計數(shù)}}while(i<3);if(i==3){coutvvendlvv"\t密碼三次錯誤,退出系統(tǒng)!"vvendl;exit(0);}return0;}///登陸界面intmanager::first_face(){charchoose[2];intcn=1;system("cls");coutvvendlvvendlvv"\t\t??"vvendlvv"\t\t?---歡迎使用庫存管理系統(tǒng) ?"vvendlvv"\t\t??"vvendlvv"\t\t?1.管理員登陸?"vvendlvv"\t\t??"vvendlvv"\t\t?2.普通用戶登陸?"vvendlvv"\t\t??"vvendlvv"\t\t?3.退出系統(tǒng)?"vvendlvv"\t\t??"vvendl<<endl<<endl<<"\t\t";coutvvendlvv"\t\t請選擇(1-3):";while(1){cin>>choose;cn=atoi(choose);if(cn<1||cn>3)coutvv"輸入錯誤,請重新輸入:(1-3)";elsebreak;}returncn;}///管理員界面intmanager::admin_face(){

system("cls");charchoose[2];intcn=0;cout<<endl;vvendlcoutvvendlvvendlvvendlvv"\t\t??"vvendlvv"\t\t? 歡迎使用庫存管理系統(tǒng) ?"vvendlvv"\t\t??"vvendlvv"\t\t?1.入庫管理?"vvendlvv"\t\t??"vvendlvv"\t\t?2.出庫管理?"vvendlvv"\t\t??"vvendlvv"\t\t?3.查詢統(tǒng)計?"vvendlvv"\t\t??"vvendlvv"\t\t?4.商品信息修改?"vvendlvv"\t\t??"vvendlvv"\t\t?5.修改密碼?"vvendlvv"\t\t??"vvendlvv"\t\t?6.退出系統(tǒng)?"vvendlvv"\t\t??"vvendl<<endl<<"\t\t";coutvvendlvv"\t\t請選擇(1-6):”;while(1){cin>>choose;cn=atoi(choose);if(cn<1llcn>6)coutvvendlvv"\t輸入錯誤,請重新輸入:(1-6)";elsebreak;}returncn;}///普通用戶界面intmanager::common_face(){system("cls");charchoose[2];intcn=1;coutvvendl;coutvvendlvvendlvv"\t\t??"vvendlvv"\t\t? ----歡迎使用庫存管理系統(tǒng)----?"vvendlvv"\t\t??"

1.查詢統(tǒng)計1.查詢統(tǒng)計."vvendlvv"\t\t.?”vvendlvv"\t\t. 2.退出系統(tǒng) ."vvendlvv"\t\t.."vvendlvv"\t\t " vvendlvvendlvv"\t\t";coutvvendlvv"\t\t請選擇(1-2):”;while(1){cin>>choose;cn=atoi(choose);if(cn<1llcn>2)coutvvendlvv"\t輸入錯誤,請重新輸入:(1-2)";elsebreak;}returncn;}//////選擇界面1voidmanager::choose_face1(){intcn=0;charchoose[2];while(1){system("cls");coutvvendlvvendl;coutvv"\t===vv"\tl"vvendl======"vvendlvv"\tl 入庫管理 l"vvendlvv"\tl"vvendlvv"\tl1.新產(chǎn)品入庫l"vvendlvv"\tl"vvendlvv"\tl2.已有商品入庫l"vvendlvv"\tl"vvendlvv"\tl3.返回l"vvendlvv"\tl"vvendlvv"\t=========="vvendlvvendlvv"\t\t";coutvvendlvv"\t\t請選擇(1-3):";{cin>>choose;cn=atoi(choose);if(cn<1||cn>3)cout<<endl<<"\t輸入錯誤,請重新輸入:(1-3)";elsebreak;}switch(cn){case1:goods_in();break;case2:goods_in1();break;case3:return;}}}///////選擇界面2voidmanager::choose_face2(){while(1){switch(admin_face()){case1:choose_face1();break;case2:goods_out();break;case3:select();break;case4:modify();break;case5:enter();break;case6:{coutvvendlvv"\t退出系統(tǒng),再見!"vvendl;exit(O);}}}}//////選擇界面3voidmanager::choose_face3(){

{switch(common_face()){case1:select();break;case2:{coutvvendlvv"\t退出系統(tǒng),再見!"vvendl;exit(O);}}}}////////查詢voidmanager::select(){intcn=0;charchoose[2];while(1){system("cls");cout<<endl<<endl;cout"\t=====================<<"\t|"<<endl<<"\t|endl<<"\t|"<<endlTOC\o"1-5"\h\z<< "\t||"<<endl<<"\t|"<<endl<< "\t||"<<endl<<"\t|"<<endl<< "\t||"<<endl<<"\t|"<<endl<< "\t||"<<endl<<"\t|"<<endl<< "\t||"<<endl<<"\t|"<<endl<<"\t|<<============================"<<endl<<============================"<<endl商品查詢 |"<<1.按商品編號查詢2.按商品名稱查詢3.按商品價格高低輸出4.查詢所有庫存商品5.查詢所有已出庫商品6.統(tǒng)計所有庫存商品價格<<"\t|"<<endl<<"\tl7.統(tǒng)計所有庫存商品總量l"<<endl<<"\tl"<<endl<<"\tl8.返回l"<<endl<<"\tl"<<endl<<"\t====================================="<<endl<<endl<<"\t\t";coutvvendlvv"\t\t請選擇(1-8):”;while(1){cin>>choose;cn=atoi(choose);if(cnv1llcn>8)coutvvendlvv"\t輸入錯誤,請重新輸入:(1-8)";elsebreak;}switch(cn){case1:select_no();break;case2:select_gname();break;case3:print();break;case4:select_all();break;case5:select_out();break;case6:add_price();break;case7:add_count();break;case8:return;}//////修改voidmanager::modify(){system("cls");intcn=0;<<charchoose[2];cout<<"\n\n\n";cout<<"\t============================================================="<<endl<<"\t|"<<endl<<"\t|商品信息修改|"<<endl<<"\t|"<<endl<<"\t|1.修改商品名稱|"<<endl<<"\t|"<<endl<<"\t|2.修改商品單位|"<<endl<<"\t|"<<endl<<"\t|3.修改商品規(guī)格|"<<endl<<"\t|"<<endl<<"\t|4.修改商品品牌|"<<endl<<"\t|"<<endl<<"\t|5.修改商品生產(chǎn)日期|"<<endl<<"\t|"<<endl<<"\t|6.修改商品價格|"<<endl<<"\t|"<<endl<<"\t|7.修改商品保質(zhì)期|"<<endl<<"\t|"<<endl<<"\t|8.返回|"<<endl<<"\t|"<<endl<<"\t==========="<<endl<<endl<<"\t\t";coutvvendlvv"\t\t請選擇(1-8):”;while(1){cin>>choose;cn=atoi(choose);if(cn<1||cn>8)cout<<endl<<"\t輸入錯誤,請重新輸入:(1-8)";elsebreak;}switch(cn){case1:m_gname();break;case2:m_unit();break;case3:m_standards();break;case4:m_brand();break;case5:m_producetime();break;case6:m_price();break;case7:m_EXP();break;case8:return;}}voidmanager::add_count()〃統(tǒng)計庫存總商品數(shù){system("cls");inti,total_count=0,mark;in*p1;list_in();if(head1==NULL){coutvvendlvv"\t\t倉庫中還沒有貨物,請先入庫貨物:"vvendlvvendl;system("pause");return;}p1=head1;for(i=0;i<total_in;i++){mark=p1->count_in;total_count=mark+total_count;p1=p1->next;}coutvv"\n\n\t\t\t庫存報告!"vvendl;cout<<"\n\t\t您好!倉庫中共有商品"<<total_in<<"種,"<<"總計"<<total_count<<"件!"vvendlvvendl;system("pause");}voidmanager::add_price()〃統(tǒng)計庫存總價值{system("cls");inti,mark;doubletotal_price=0,flag;in*p1;list_in();if(head1==NULL){coutvv"\n\t\t倉庫中還沒有貨物,請先入庫貨物:"vvendl;system("pause");return;}p1=head1;for(i=0;ivtotal_in;i++){mark=p1->count_in;flag=p1->price;total_price=mark*flag+total_price;p1=p1->next;}coutvv"\n\t\t\t庫存報告!"vvendl;coutvv"\n\t\t您好!倉庫中共有商品"vvtotal_invv"種,其總價值是:"vvtotal_pricevv"元"vvendl;system("pause");}voidmanager::select_no()//按商品編號查詢{system("cls");stringno1;inti;in*p1,*p2;list_in();if(head1==NULL){coutvv"\n\t\t倉庫中還沒有貨物,請先入庫貨物:"vvendl;system("pause");return;}do{p2=p1=head1;coutvvendlvv"\t\t請輸入要查詢的商品編號:";cin>>no1;coutvv"\n\n";while((no1!=p1->no)&&(p1->next!=NULL)){p2=p1;p1=p1->next;}if(no1==p1->no){coutvv"商品編號名稱單位規(guī)格品牌 生產(chǎn)日期 價格保質(zhì)期庫存數(shù)量入庫時間"vvendl;coutvvsetw(7)vvp1->novvsetw(7)vvp1->gnamevvsetw(7)vvp1->unitvvsetw(6)vvp1->standardsvvsetw(6)vvp1->brandvvsetw(6)vvp1->producetimevvsetw(10)vvp1->pricevvsetw(7)vvp1->EXPvvsetw(8)vvp1->count_invvsetw(10)vvp1->time_invvendl;i=0;}else{coutvv"\t\t對不起,該商品不存在,請重新輸入!"vvendl;i=1;}}while(i==1);coutvvendlvvendl;coutvvendlvv"\t\t按任意鍵繼續(xù)!"vvendl;system("pause");}voidmanager::select_gname()//按名稱查找{system("cls");list_in();stringgname1,gname2,gname3,gname4,gname5,gname6;inti;in*p1,*p2;if(head1==NULL){coutvv"\n\t\t倉庫中還沒有貨物,請先入庫貨物:"vvendl;system("pause");return;}do{p2=p1=head1;coutvvendlvv"\t\t請輸入要查詢的名稱:";cin>>gname1;gname5=gname1.substr(0,2);while((gname5!=p1->gname.substr(0,2))&&(p1->next!=NULL)){p2=p1;p1=p1->next;}if(gname5==p1->gname.substr(0,2)){p1=head1;coutvv"商品編號名稱單位規(guī)格品牌生產(chǎn)日期 價格保質(zhì)期庫存數(shù)量入庫時間"vvendl;while(p1!=NULL){gname2=gname1.substr(0,2);gname3=p1->gname;gname4=gname3.substr(0,2);if(gname2==gname4)coutvvsetw(7)vvp1->novvsetw(7)vvp1->gnamevvsetw(7)vvp1->unitvvsetw(6)vvp1->standardsvvsetw(6)vvp1->brandvvsetw(6)vvp1->producetimevvsetw(10)vvp1->pricevvsetw(7)vvp1->EXPvvsetw(8)vvp1->count_invvsetw(10)vvp1->time_invvendl;p1=p1->next;}i=0;}else{coutvv"\t\t對不起,該商品不存在,請重新輸入!"vvendl;i=1;}}while(i==1);coutvvendlvv"\t\t按任意鍵繼續(xù)!"vvendl;system("pause");}voidmanager::select_all()〃查詢庫存信息{system("cls");list_in();in*p1;if(head1==NULL){coutvv"\n\t\t倉庫中沒有存貨,請先入庫貨物!"<<endl;system("pause");return;}p1=head1;cout<<endl<<endl;coutvv"商品編號名稱單位規(guī)格品牌生產(chǎn)日期價格保質(zhì)期庫存數(shù)量入庫時間"vvendl;if(head1!=NULL)do{coutvvsetw(7)vvp1->novvsetw(7)vvp1->gnamevvsetw(7)vvp1->unitvvsetw(6)vvp1->standardsvvsetw(6)vvp1->brandvvsetw(6)vvp1->producetimevvsetw(10)vvp1->pricevvsetw(7)vvp1->EXPvvsetw(8)vvp1->count_invvsetw(10)vvp1->time_invvendl;p1=p1->next;}while(p1!=NULL);coutvvendl;system("pause");}voidmanager::select_out()〃查詢出庫信息{system("cls");list_out();out*p1;if(head2==NULL){coutvv"\n\t\t倉庫中沒有存貨,請先入庫貨物!"vvendl;system("pause");return;}p1=head2;cout<<endl<<endl;coutvv"商品編號名稱單位規(guī)格品牌生產(chǎn)日期價格保質(zhì)期出庫數(shù)量出庫時間"vvendl;if(head2!=NULL)do{coutvvsetw(7)vvp1->novvsetw(7)vvp1->gnamevvsetw(7)vvp1->unitvvsetw(6)vvp1->standardsvvsetw(6)vvp1->brandvvsetw(6)vvp1->producetimevvsetw(10)vvp1->pricevvsetw(7)vvp1->EXPvvsetw(8)vvp1->count_outvvsetw(10)vvp1->time_outvvendl;p1=p1->next;}while(p1!=NULL);coutvv"\n\t\t按任意鍵繼續(xù)!"vvendl;system("pause");}voidmanager::print()//排序函數(shù){system("cls");stringno;stringgname;stringunit;stringstandards;stringbrand;stringproducetime;doubleprice;stringEXP;intcount_in;stringtime_in;list_in();if(head1==NULL){coutvv"\n\t\t倉庫中沒有存貨,請先入庫貨物!"vvendl;system("pause");return;}in*head=NULL,*t;t=head1;while(t!=NULL)〃重建一個鏈表,在新鏈表上進(jìn)行排序{no=t->no;gname=t->gname;unit=t->unit;standards=t->standards;brand=t->brand;producetime=t->producetime;price=t->price;EXP=t->EXP;count_in=t->count_in;time_in=t->time_in;in *temp=newin(no,gname,unit,standards,brand,producetime,price,EXP,count_in,time_in);if(head==NULL){head=temp;temp->next=NULL;}else{temp->next=head;head=temp;}t=t->next;}in*tt=newin("O","O","O","O","O","O",O,"O",O,"O");//最后一個節(jié)點(diǎn)所有字段默認(rèn)為0tt->next=head;head=tt; //設(shè)定最后一個節(jié)點(diǎn),交換指針時用in*temp=NULL;//默認(rèn)為NULL,鏈表結(jié)尾in*p1=head;in*p2=head->next;while(p1->next!=temp){while(p2->next!=temp){if(p1->next->price<p2->next->price)//相鄰兩個節(jié)點(diǎn)比較,交換指針{p1->next=p2->next;p2->next=p2->next->next;p1->next->next=p2;p1=p1->next;p2=p1->next;}temp=p2;p1=head;p2=p1->next;}in*p3=head->next;coutvv"商品編號名稱單位規(guī)格品牌生產(chǎn)日期價格保質(zhì)期庫存數(shù)量入庫時間"vvendl;while(p3!=NULL){coutvvsetw(7)vvp3->novvsetw(7)vvp3->gnamevvsetw(7)vvp3->unitvvsetw(6)vvp3->standardsvvsetw(6)vvp3->brandvvsetw(6)vvp3->producetimevvsetw(10)vvp3->pricevvsetw(7)vvp3->EXPvvsetw(8)vvp3->count_invvsetw(10)vvp3->time_invvendl;p3=p3->next;}coutvv"\n\t\t信息排序完成,按任意鍵繼續(xù)ooooo"vvendl;system("pause");}voidmanager::write()〃把鏈表寫入文件{ofstreamfout1("D:\\in.txt");fout1vvtotal_invvendl;in*t1=head1;for(inti=0;ivtotal_in;i++){fout1vvsetiosflags(ios::left)vvsetw(15)vvt1->novv" "vvsetw(15)vvt1->gnamevv""vvsetw(15)vvt1->unitvv""vvsetw(15)vvt1->standardsvv""vvsetw(15)vvt1->brandvv""vvsetw(15)vvt1->producetimevv""vvsetw(15)vvt1->pricevv""vvsetw(15)vvt1->EXPvv""vvsetw(15)vvt1->count_invv""vvsetw(15)vvt1->time_invv""vvsetw(15)vvendl;t1=t1->next;}fout1.close();}voidmanager::m_unit() //修改的商品單位{system("cls");in*p1,*p2;stringunit1;strings;stringno1;inti;list_in();if(head1==NULL){coutvv"\n\t\t倉庫中沒有存貨,請先入庫貨物!"vvendl;system("pause");return;}do{p2=p1=head1;coutvvendl<<"\t\t請輸入要修改的商品的商品編號:";cin>>no1;while((no1!=p1->no)&&(p1->next!=NULL)){p2=p1;p1=p1->next;}if(no1==p1->no){coutvv"\n\t\t該商品的單位目前是:"vvpl->unitvvendl;coutvvendl<<"\t\t請輸入修改后的商品單位:"vvendl<<endl;coutvvendlvv"\t\t商品單位:";cin>>unitl;pl->unit=unitl;i=0;}else{coutvv"\n\t\t對不起,該商品不存在,請重新輸入!"vvendl;i=l;}}while(i==l);coutvvendlvv"\t\t這是您輸入的信息:"vvendl;coutvvendlvv"\t\t商品編號: "vvnolvvendl;coutvvendlvv"\t\t商品單位: "vvunitlvvendl;write();coutvvendl<<"\n\t信息修改完成,按任意鍵繼續(xù)。。。。。"vvendl;system("pause");}///////////voidmanager::m_standards() //修改商品規(guī)格{system("cls");in*p1,*p2;stringstandards1;stringno1;inti;list_in();p2=p1=head1;if(head1==NULL){coutvv"\n\t\t倉庫中沒有存貨,請先入庫貨物!"vvendl;system("pause");return;}do{p2=p1=head1;coutvvendlvvendlvv"\t\t請輸入要修改的商品的商品編號:";cin>>no1;while((no1!=p1->no)&&(p1->next!=NULL)){p2=p1;p1=p1->next;}if(no1==p1->no){coutvv"\n\t\t該商品的規(guī)格目前是:"vvpl->standardsvvendl;coutvvendlvv"\t\t請輸入修改后的商品規(guī)格:"vvendlvvendl;coutvvendlvv"\t\t商品規(guī)格:";cin>>standardsl;pl->standards=standardsl;i=0;}else{coutvv"\t\t對不起,該商品不存在,請重新輸入!"vvendl;i=l;}}while(i==l);cout<<endl<<"\t\t這是您輸入的信息:"<<endl;cout<<endl<<"\t\t商品編號:"<<no1<<endl;cout<<endl<<"\t\t商品規(guī)格:"<<standards1<<endl;write();coutvvendlvv"\t\t信息修改完成,按任意鍵繼續(xù)。。。。。"vvendl;system("pause");}voidmanager::m_brand()〃修改商品品牌{system("cls");in*p1,*p2;stringbrand1;strings;stringno1;inti;list_in();if(head1==NULL){coutvv"\n\n\t\t倉庫中沒有存貨,請先入庫貨物!”vvendl;system("pause");return;}do{p2=p1=head1;coutvvendlvvendlvv"\t\t請輸入要修改的商品的商品編號:";cin>>no1;while((no1!=p1->no)&&(p1->next!=NULL)){p2=p1;p1=p1->next;}if(no1==p1->no){coutvv"\n\t\t該商品的品牌目前是:"vvpl->brandvvendl;coutvvendlvv"\t\t請輸入修改后的商品品牌:"<<endl<<endl;coutvvendlvv"\t\t商品品牌:";cin>>brandl;pl->brand=brandl;i=0;}else{coutvv"\t\t對不起,該商品不存在,請重新輸入!"<<endl;i=1;}}while(i==1);cout<<endl<<"\t\t這是您輸入的信息:"<<endl;cout<<endl<<"\t\t商品編號:"<<no1<<endl;cout<<endl<<"\t\t商品品牌:"<<brand1<<endl;write();coutvvendlvv"\n\t\t信息修改完成,按任意鍵繼續(xù)。。。。。"vvendl;system("pause");}voidmanager::m_producetime()〃修改商品生產(chǎn)日期{system("cls");in*p1,*p2;stringproducetime1;stringc;stringno1;inti;list_in();if(head1==NULL){coutvv"\n\n\t\t倉庫中沒有存貨,請先入庫貨物!”vvendl;system("pause");return;}do{p2=p1=head1;coutvvendlvv"\t\t請輸入要修改的商品的商品編號:";cin>>no1;while((no1!=p1->no)&&(p1->next!=NULL)){p2=p1;p1=p1->next;}if(no1==p1->no){coutvv"\n\t\t該商品的生產(chǎn)日期目前是:"vvpl->producetimevvendl;coutvvendlvv"\t\t請輸入修改后的信息:"vvendlvvendl;coutvvendlvv"\t\t商品生產(chǎn)日期:";cin>>producetimel;pl->producetime=producetimel;i=0;else{coutvv"\t\t對不起,該商品不存在,請重新輸入!"vvendl;i=1;}}while(i==1);coutvvendlvv"\t\t這是您輸入的信息:"vvendl;coutvvendlvv"\t\t商品編號:"vvno1vvendl;coutvvendlvv"\t\t商品生產(chǎn)日期:"vvproducetimelvvendl;write();coutvv"\n\t\t信息修改完成,按任意鍵繼續(xù)ooooo"vvendl;system("pause");}voidmanager::m_EXP()〃修改商品保質(zhì)期{system("cls");in*pl,*p2;stringEXPl;strings;stringnol;inti;list_in();if(headl==NULL){coutvv"\n\t\t倉庫中沒有存貨,請先入庫貨物!"vvendl;system("pause");return;}do{p2=pl=headl;coutvv"\n\n\t\t請輸入要修改的商品的商品編號:";cin>>nol;while((nol!=pl->no)&&(pl->next!=NULL)){p2=pl;pl=pl->next;}if(nol==pl->no){coutvv"\n\t\t該商品的保質(zhì)期目前是:"vvp1->EXPvvendl;coutvvendlvv"\t\t請輸入修改后的信息:"vvendlvvendl;coutvv"商品保質(zhì)期:";cin>>EXP1;p1->EXP=EXP1;i=0;}else{coutvv"\t\t對不起,該商品不存在,請重新輸入!"vvendl;i=1;}}while(i==1);cout<<"\n\t\t這是您輸入的信息:"vvendl;cout<<"\n\t\t商品編號:"vvno1vvendl;coutvv"\n\t\t商品保質(zhì)期: "vvEXP1vvendl;write();coutvv"\n\t\t信息修改完成, 按任意鍵繼續(xù)ooooo"vvendl;system("pause");}voidmanager::m_price()〃修改商品價格{system("cls");in*p1,*p2;doubleprice1;strings;stringno1;inti;list_in();if(head1==NULL){coutvv"\n\t\t倉庫中沒有存貨,請先入庫貨物! "vvendlvvendl;system("pause");return;}do{p2=p1=head1;coutvv"\n\t\t請輸入要修改的商品的商品編號:";cin>>no1;while((no1!=p1->no)&&(p1->next!=NULL)){p2=p1;p1=p1->next;}if(no1==p1->no){coutvv"\n\t\t該商品的價格目前是:"vvp1->pricevvendl;coutvv"\n\t請輸入修改后的信息:"vvendlvvendl;cout<<"\n\t\t商品價格:";cin>>price1;p1->price=price1;i=0;}else{coutvv"\t\t對不起,該商品不存在,請重新輸入!"vvendl;i=1;}}while(i==1);cout<<"\n\t\t這是您輸入的信息:"vvendl;cout<<"\n\t\t商品編號: "vvno1vvendl;coutvv"\n\t\t商品價格: "vvpricelvvendl;write();coutvv"\n\t\t信息修改完成,按任意鍵繼續(xù)ooooo"vvendl;system("pause");}voidmanager::m_gname()〃修改商品名稱{system("cls");in*p1,*p2;stringgname1;strings;stringno1;inti;list_in();if(head1==NULL){coutvv"\n\n\t\t倉庫中沒有存貨,請先入庫貨物!"vvendl;system("pause");return;}do{p2=p1=head1;coutvv"\n\n\t\t請輸入要修改的商品的商品編號:";cin>>no1;while((no1!=p1->no)&&(p1->next!=NULL)){p2=p1;p1=p1->next;}if(no1==p1->no){coutvv"\n\t\t該商品的名稱目前是:"vvpl->gnamevvendl;coutvvendlvv"\t\t請輸入修改后的信息:"<<endl<<endl;coutvvendlvv"\t\t商品名稱:";cin>>gnamel;pl->gname=gnamel;i=0;}else{coutvv"\t\t對不起,該商品不存在,請重新輸入!"vvendl;i=l;}}while(i==l);cout<<"\n\t\t這是您輸入的信息:"vvendlvvendl;cout<<"\n\t\t商品編號:"<<nolvvendl;cout<<"\n\t\t商品名稱: "vvgnamelvvendl;write();coutvvendlvv"\t\t信息修改完成,按任意鍵繼續(xù)。。。。。"vvendl;system("pause");}///////////////////////intmain(){manager*top;while(l){switch(top->first_face()){casel:top->pass();break;case2:top->choose_face3();break;case3:{coutvvendlvv"\t\t退出系統(tǒng),再見!"vvendl;exit(O);}}}deletetop;return0;//#include"class.h"voidmanager::list_in() //商品入庫從文件讀數(shù)據(jù)到內(nèi)存生成鏈表{if(head1==NULL){ifstreamfin("D:\\in.txt");inttotal1;stringno;stringgname;stringunit;stringstandards;stringbrand;price1,EXP1//編號//名稱//單位//規(guī)格//品牌no1,gname1,unit1,standards1,brand1,producetime1,stringproducetime;//生產(chǎn)日期doubleprice;stringEXP;stringtime_in;intcount_in;//價格//保質(zhì)期//入庫時間fin>>total1;total_in=total1;for(inti=0;i<total_in;i++){fin>>no>>gname>>unit>>standards>>brand>>producetime>>price>>EXP>>count_in>>time_in;in*temp=newin(no,gname,unit,standards,brand,producetime,price,EXP,count_in,time_in);temp->next=head1;head1=temp;}fin.close();}}//新商品入庫voidmanager::goods_in(){system("cls");inttotal_in1=0;stringno; //編號stringgname; //名稱stringunit; //單位stringstandards; //規(guī)格stringbrand; //品牌stringproducetime;//生產(chǎn)日期doubleprice;//價格stringEXP; //保質(zhì)期intcount_in;stringtime_in; //入庫時間ifstreamfin("D:\\in.txt");if(!fin)〃文件不存在時對商品入庫{in*head=NULL;in*p1,*p2;inti=0;coutvv"\n\n\t\t您進(jìn)行的是商品入庫操作! "vvendl;coutvv"\n\t\t請輸入要入庫的貨物總種類數(shù):";cin>>total_in1;for(intj=0;jvtotal_in1;j++){coutvvendl;system("cls");coutvv"\n\n\t請輸入第"vvj+lvv"種商品信息:"vvendlvvendl;if(head==NULL){coutvv"\t 商品編號(string):";cin>>no;}else{pl=p2=head;do{cout<<"\t 商品編號(string):";cin>>no;while((no!=pl->no)&&(pl->next!=NULL)){p2=pl;pl=pl->next;}if(no==pl->no){coutvv"\n\t\t對不起.該商品已經(jīng)存在,請重新輸入或選擇已有商品入庫「vvendlvvendl;i=l;

elsei=0;}while(i==1);}cout<<"\t商品名稱(string):”;cin>>gname;cout<<"\t單位(string):";cin>>unit;cout<<"\t規(guī)格(string):";cin>>standards;cout<<"\t品牌(string):";cin>>brand;cout<<"\t生產(chǎn)日期(string):";cin>>producetime;cout<<"\t價格(double):";cin>>price;cout<<"\t保質(zhì)期(string):";cin>>EXP;cout<<"\t數(shù)量(int):";cin>>count_in;cout<<"\t入庫時間(string):";cin>>time_in;inin(no,gname,unit,standards,brand,producetime,price,EXP,count_in,time_in);if(head==NULL){head=temp;temp->next=NULL;}else{temp->next=head;head=temp;}}ofstreamfout("D:\\in.txt");fout<<total_in1<<endl;in*t=head;for(intk=0;k<total_in1;k++){fout<<setiosflags(ios::left)<<setw(15)<<t->no<<""<<setw(15)<<t->gname<<""<<setw(15)<<t->unit<<""<<setw(15)<<t->standards<<""<<setw(15)<<t->brand<<"setw(15)<<t->EXP<<"!!*temp=new!!<<""<<setw(15)<<t->EXP<<"!!*temp=new!!<<""<<<<setw(15)<<t->count_in<<""<<setw(15)<<t->time_in<<"<<setw(15)<<t->count_in<<""<<setw(15)<<t->time_in<<""<<setw(15)<<endl;t=t->next;}fout.close();cout<<endl<<endl<<"該商品已經(jīng)入庫 "<<endl<<endl<<"\t";system("pause");}else//文件存在時對商品進(jìn)行入庫{fin.close();inti=0;list_in();in*p1,*p2;coutvv"\n\t\t您進(jìn)行的是商品入庫操作!"vvendl;coutvv"\n\n\t\t請輸入要入庫的貨物總種類數(shù):"vvendl;cin>>total_in1;for(intj=0;jvtotal_in1;j++){coutvvendl;system("cls");coutvv"\n\t請輸入第"vvj+lvv"種商品信息:"vvendlvvendl;do{pl=p2=headl;coutvv"\t 商品編號(string):";cin>>no;while((no!=pl->no)&&(pl->next!=NULL)){p2=pl;pl=pl->next;}if(no==pl->no){coutvv"\n\t\t對不起.該商品已經(jīng)存在,請重新輸入或選擇已有商品入庫「vvendlvvendl;i=l;}elsei=0;}while(i==l);cout<<"\t商品名稱(string):";cin>>gname;cout<<"\t單位(string):";cin>>unit;cout<<"\t規(guī)格(string):";

cin>>standards;cout<<"\t 品牌(string):";cin>>brand;cout<<"\t 生產(chǎn)日期(string):";cin>>producetime;cout<<"\t 價格(double):";cin>>price;cout<<"\t 保質(zhì)期(string):";cin>>EXP;cout<<"\t數(shù)量(int):";cin>>count_in;cout<<"\t 入庫時間(string):";cin>>time_in;in*temp=newin(no,gname,unit,standards,brand,producetime,price,EXP,count_in,time_in);if(head1==NULL){head1=temp;temp->next=NULL;}else{temp->next=head1;head1=temp;}}total_in=total_in1+total_in;ofstreamfout1("D:\\in.txt");fout1<<total_in<<endl;list_in();in*t1=head1;for(intk1=0;k1<total_in;k1++){fout1<<setiosflags(ios::left)TOC\o"1-5"\h\z<<setw(15)<<t1->no<<" "<<setw(15)<<t1->gname<<" "<<setw(15)<<t1->unit<<" "<<setw(15)<<t1->standards<<""<<setw(15)<<t1->brand<<"<<setw(15)<<t1->producetime<<""<<setw(15)<<t1->price<<<<setw(15)<<t1->EXP<<" "<<setw(15)<<t1->count_in<<" "<<setw(15)<<t1->time_in<<" "<<setw(15)<<endl;t1=t1->next;}fout1.close();cout<<"\n\n\t該商品已經(jīng)入庫 "<<endl<<endl<<"\t";system("pause");}}//已有商品入庫voidmanager::goods_in1(){system("cls");in*p1,*p2;stringno1;intno,mark;list_in();if(head1==NULL){coutvv”\n\n\t\t倉庫中沒有存貨,請先入庫貨物!”vvendl;system("pause");return;}list_in();p2=p1=head1;coutvvendlvvendl<<"\t\t請輸入要入庫的商品的商品編號:";cin>>no1;coutvvendlvv"\t\t請輸入該商品要入庫的數(shù)量:";cin>>no;while((no1!=p1->no)&&(p1->next!=NULL)){p2=p1;p1=p1->next;}if(no1==p1->no){mark=p1->count_in;p1->count_in=mark+no;}write();coutvvendlvv"\t\t該商品已入庫,按任意鍵繼續(xù)。。。。。"vvendl;system("pause");}voidmanager::list_out()//商品出庫從文件讀數(shù)據(jù)到內(nèi)存生成鏈表{if(head2==NULL){ifstreamfin("D:\\out.txt");;inttotal;

inttotal1;stringno;//編號stringgname;//名稱stringunit;//單位stringstandards;//規(guī)格stringbrand;//品牌stringproducetime;//生產(chǎn)日期doubleprice;//價格stringEXP;//保質(zhì)期intcount_out;stringtime_out;//出庫時間fin>>total1;total=total1;fin.ignore();for(inti=0;i<total;i++)*temp=new{fin>>no>>gname>>unit>>standards>>brand>>producetime>>price>>EXP>>count_out>>time_out;outout(no,gname,unit,standards,brand,producetime,price,EXP,count_out,time_out);temp->next=head2;*temp=newhead2=temp;}fin.close();}}/////商品出庫voidmanager::goods_out(){system("cls");stringtime1; //商品出庫時間stringno11; //商品編號intno_out1; //商品出庫數(shù)量intno_out; //當(dāng)前庫存量inttotal_out2,flag,mark;inti,j;stringno1; //編號stringgname; //名稱stringunit1; //單位stringstandards1; //規(guī)格stringbrand1; //品牌stringproducetime1;//生產(chǎn)日期doubleprice1; //價格stringEXP1;//保質(zhì)期stringtime_out1; //出庫時間intcount_out1; //數(shù)量out*head=NULL;ifstreamfin1("D:\\out.txt");if(!fin1){

溫馨提示

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

評論

0/150

提交評論