版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
C++編寫倉(cāng)庫(kù)管理系統(tǒng)//functions.h#include<iostream>#include<string>#include<fstream>#include<cassert>#include<iomanip>#include<conio.h>usingnamespacestd;voiddenglu();voidchoice();voidzhuce();charfirst_face();voidin_storage();voidselect_time();voidout_storage();voidselect_ele();voidselect_name();voidselect_kind();voidselect_all();voidcall();voiddenglu(){ stringusername1,passport1,name1; stringusername,passport; ifstreamstoreFile("userdate.txt"); if(!storeFile) { cout<<"\n\n\t對(duì)不起,顧客文獻(xiàn)丟失。。。\n\n\t"; system("pause"); return; }cout<<"顧客登錄:"<<endl; cout<<"請(qǐng)輸入顧客名:"; cin>>username;cout<<"請(qǐng)輸入密碼:"; cin>>passport; boolflag=false; while(storeFile>>username1>>passport1>>name1) { if(username1==username&&passport1==passport) { flag=true;system("cls"); cout<<"登錄成功!"<<endl; cout<<"歡迎您,"<<name1<<"^_^"<<endl; system("pause"); } elseif(username1==username||passport1==passport){ cout<<"顧客名或密碼錯(cuò)誤!"<<endl; denglu(); } } storeFile.close(); call(); choice();}voidchoice(){ chara; a=first_face();while(1){ switch(a){ case'1':in_storage();break; case'2':out_storage();break; case'3':select_ele();break; case'4':system("cls");cout<<"\t謝謝您旳使用!\n\n\t\t"; exit(0); break; default:break; } }}charfirst_face(){ system("cls");//系統(tǒng)清屏 cout<<"==============================="<<endl; cout<<"**"<<endl; cout<<"*倉(cāng)庫(kù)管理系統(tǒng)*"<<endl; cout<<"**"<<endl; cout<<"*1.商品入庫(kù)*"<<endl; cout<<"**"<<endl; cout<<"*2.商品出庫(kù)*"<<endl; cout<<"**"<<endl; cout<<"*3.商品查詢*"<<endl; cout<<"**"<<endl; cout<<"*4.退出系統(tǒng)*"<<endl; cout<<"**"<<endl; cout<<"==============================="<<endl; returngetch();}//入庫(kù)voidin_storage(){ system("cls");//系統(tǒng)清屏 stringname;//商品名 doubleprice;//價(jià)格 stringstoreNo;//倉(cāng)庫(kù)編號(hào) stringkinds;//商品大類 stringshelfNo;//貨架號(hào) longcount=0;//商品數(shù)量 stringtime;//入庫(kù)時(shí)間 cout<<"\n"; cout<<"商品入庫(kù),請(qǐng)輸入有關(guān)信息:"; cout<<endl<<"\t商品名稱:"; cin>>name; cout<<endl<<"\t商品價(jià)格:"; cin>>price; cout<<endl<<"\t商品數(shù)量:"; cin>>count; cout<<endl<<"\t倉(cāng)庫(kù)編號(hào):"; cin>>storeNo; cout<<endl<<"\t商品大類:"; cin>>kinds; cout<<endl<<"\t貨架編號(hào):"; cin>>shelfNo; cout<<endl<<"\t入庫(kù)時(shí)間(例如:2023.01.01):"; cin>>time; ofstreamstoreFile("store.txt",ios::app); storeFile<<setiosflags(ios::left)<<setw(20)<<name<<"" <<setw(15)<<price<<""<<setw(10)<<count<<"" <<setw(10)<<storeNo<<""<<setw(20)<<kinds<<"" <<shelfNo<<""<<setw(20)<<time<<endl; storeFile.close(); cout<<"\n\n\t該商品已經(jīng)入庫(kù)……\n\n\t"; cout<<"與否繼續(xù)?1.是2.否"<<endl; inta; cin>>a; if(a==1){in_storage();} if(a==2){ first_face(); choice(); } system("pause");//系統(tǒng)暫停}//出庫(kù)voidout_storage(){ system("cls");//系統(tǒng)清屏 stringname;//商品名 cout<<endl<<"\t商品出庫(kù),輸入出庫(kù)商品信息:"<<endl; cout<<"\n\t商品名稱:"; cin>>name; ifstreamstoreFile("store.txt"); if(!storeFile) { ofstreamstoreFile1("store.txt"); storeFile1.close(); cout<<"\n\n\t庫(kù)存為空……\n\n\t"; cout<<"與否繼續(xù)?1.是2.否"<<endl; inta; cin>>a; if(a==1){in_storage();} elseif(a==2){ first_face(); choice();} } boolflag=false; stringname1;//商品名 doubleprice1;//價(jià)格 stringstoreNo1;//倉(cāng)庫(kù)編號(hào) stringkinds1;//商品大類 stringshelfNo1;//貨架號(hào) longcount1=0;//商品數(shù)量 ofstreamtempFile("temp.txt"); while(storeFile>>name1>>price1>>count1>>storeNo1>>kinds1>>shelfNo1) { if(name1==name) flag=true; else { tempFile<<setiosflags(ios::left)<<setw(20)<<name1<<"" <<setw(15)<<price1<<""<<setw(10)<<count1<<"" <<setw(10)<<storeNo1<<""<<setw(20)<<kinds1<<"" <<shelfNo1<<endl; } } tempFile.close(); storeFile.close(); if(!flag) { cout<<"\n\n\t倉(cāng)庫(kù)中沒(méi)有該商品!\n\n\t"; system("pause"); return; } ofstreamstoreFile1("store.txt"); ifstreamtempFile1("temp.txt"); storeFile1<<tempFile1.rdbuf(); storeFile1.close(); tempFile1.close(); cout<<"\n\t這些商品已經(jīng)出庫(kù),請(qǐng)仔細(xì)檢查?。?!\n\n\t"; cout<<"與否繼續(xù)?1.是2.否"<<endl; inta; cin>>a; if(a==1){out_storage();} if(a==2){ first_face(); choice(); } system("pause");}//查詢voidselect_ele(){ while(1) { system("cls"); cout<<"\n"<<endl; cout<<"\t================================"<<endl <<"\t"<<endl <<"\t商品查詢"<<endl <<"\t"<<endl <<"\t1.按商品名稱查詢"<<endl <<"\t"<<endl <<"\t2.按入庫(kù)時(shí)間查詢"<<endl <<"\t"<<endl <<"\t3.查看所有商品"<<endl <<"\t"<<endl <<"\t4.按商品大類查詢"<<endl <<"\t"<<endl <<"\t5.返回"<<endl <<"\t"<<endl <<"\t================================="<<endl; cout<<"\n\t\t"; charselect=getch(); switch(select) { case'1':select_name();break; case'2':select_time();break; case'3':select_all();break; case'4':select_kind();break; case'5':first_face();choice();break; default:break; } }}//按商品名稱查詢voidselect_name(){ system("cls"); cout<<endl<<"\t按商品名查詢:"<<endl; cout<<"\n\t輸入商品名:"; stringname; cin>>name; stringname1;//商品名 stringtime1; doubleprice1;//價(jià)格 stringstoreNo1;//倉(cāng)庫(kù)編號(hào) stringkinds1;//商品大類 stringshelfNo1;//貨架號(hào) longcount1=0;//商品數(shù)量 ifstreamstoreFile("store.txt"); if(!storeFile) { cout<<"\n\n\t對(duì)不起,你旳庫(kù)存為空……\n\n\t"; system("pause"); return; } boolflag=false; cout<<"\n商品名"<<"價(jià)格"<<"商品數(shù)量"<<"倉(cāng)庫(kù)編號(hào)" <<"商品大類"<<"貨架號(hào)"<<"入庫(kù)時(shí)間"<<endl; while(storeFile>>name1>>price1>>count1>>storeNo1>>kinds1>>shelfNo1>>time1) { if(name1==name) { flag=true; cout<<setiosflags(ios::left)<<""<<name1<<"" <<price1<<""<<count1<<"" <<storeNo1<<""<<kinds1<<"" <<shelfNo1<<""<<time1<<endl; } } storeFile.close(); if(!flag) cout<<"\n\n對(duì)不起,庫(kù)存中沒(méi)有這個(gè)商品……"; cout<<"\n"<<endl; system("pause");}voidselect_time()//按入庫(kù)時(shí)間查詢{ system("cls"); cout<<"\n\t按入庫(kù)時(shí)間查詢:"<<endl; cout<<"\n\t輸入入庫(kù)時(shí)間(例如:2023.01.01):"; stringtime; cin>>time; stringname1;//商品名 doubleprice1;//價(jià)格 stringstoreNo1;//倉(cāng)庫(kù)編號(hào) stringkinds1;//商品大類 stringshelfNo1;//貨架號(hào) stringtime1; longcount1=0;//商品數(shù)量 ifstreamstoreFile("store.txt"); if(!storeFile) { cout<<"\n\n\t對(duì)不起,你旳庫(kù)存為空……\n\n\t"; system("pause"); return; } boolflag=false; cout<<"\n商品名"<<setw(15)<<"價(jià)格"<<setw(10)<<"商品數(shù)量"<<setw(10)<<"倉(cāng)庫(kù)編號(hào)" <<setw(10)<<"商品大類"<<setw(15)<<"貨架號(hào)\n"<<endl; while(storeFile>>name1>>price1>>count1>>storeNo1>>kinds1>>shelfNo1>>time1) { if(time1==time) { flag=true; cout<<setiosflags(ios::left)<<setw(15)<<name1<<"" <<setw(10)<<price1<<""<<setw(10)<<count1<<"" <<setw(10)<<storeNo1<<""<<setw(15)<<kinds1<<"" <<shelfNo1<<endl; } } storeFile.close(); if(!flag) cout<<"\n\n對(duì)不起,倉(cāng)庫(kù)中沒(méi)有此類商品!"; cout<<"\n"<<endl; system("pause");}voidselect_all()//查看所有商品{ system("cls"); stringname1;//商品名 stringtime1;//入庫(kù)時(shí)間 doubleprice1;//價(jià)格 stringstoreNo1;//倉(cāng)庫(kù)編號(hào) stringkinds1;//商品大類 stringshelfNo1;//貨架號(hào) longcount1=0;//商品數(shù)量 ifstreamstoreFile("store.txt"); if(!storeFile) { cout<<"\n\n\t對(duì)不起,你旳庫(kù)存為空……\n\n\t"; system("pause"); return; } boolflag=false; cout<<"\n商品名"<<"價(jià)格"<<"商品數(shù)量"<<"倉(cāng)庫(kù)編號(hào)" <<"商品大類"<<"貨架號(hào)"<<"入庫(kù)時(shí)間"<<endl; while(storeFile>>name1>>price1>>count1>>storeNo1>>kinds1>>shelfNo1>>time1) { flag=true; cout<<setiosflags(ios::left)<<""<<name1<<"" <<price1<<""<<count1<<"" <<storeNo1<<""<<kinds1<<"" <<shelfNo1<<""<<time1<<endl; } storeFile.close(); system("pause");}//按大類查詢voidselect_kind(){ system("cls"); cout<<"\n\t按商品大類查詢:"<<endl; cout<<"\n\t輸入大類名:"; stringkinds; cin>>kinds; stringname1;//商品名 doubleprice1;//價(jià)格 stringstoreNo1;//倉(cāng)庫(kù)編號(hào) stringkinds1;//商品大類 stringshelfNo1;//貨架號(hào) stringtime1;//入庫(kù)時(shí)間 longcount1=0;//商品數(shù)量 ifstreamstoreFile("store.txt"); if(!storeFile) { cout<<"\n\n\t對(duì)不起,你旳庫(kù)存為空……\n\n\t"; system("pause"); return; } boolflag=false; cout<<"\n商品名"<<"價(jià)格"<<"商品數(shù)量"<<"倉(cāng)庫(kù)編號(hào)" <<"商品大類"<<"貨架號(hào)"<<"入庫(kù)時(shí)間"<<endl; while(storeFile>>name1>>price1>>count1>>storeNo1>>kinds1>>shelfNo1>>time1) { if(kinds1==kinds) { flag=true; cout<<setiosflags(ios::left)<<setw(15)<<name1<<"" <<setw(10)<<price1<<""<<setw(10)<<count1<<"" <<setw(10)<<storeNo1<<""<<setw(15)<<kinds1<<"" <<shelfNo1<<""<<setw(15)<<time1<<endl; } } storeFile.close(); if(!flag) cout<<"\n\n對(duì)不起,庫(kù)存中沒(méi)有此類商品……"; cout<<"\n"<<endl; system("pause");}voidzhuce(){ system("cls");//系統(tǒng)清屏 stringusername,passport,passport1,name,miyao,jiami;cout<<"請(qǐng)輸入顧客名:"; cin>>username; cout<<"請(qǐng)輸入密碼:"; cin>>passport;cout<<"請(qǐng)?jiān)俅屋斎朊艽a:";cin>>passport1; if(passport==passport1){ cout<<"請(qǐng)輸入您旳姓名:"; cin>>name; } elseif(passport!=passport1){ cout<<"兩次輸入旳密碼不一致,請(qǐng)重新輸入!"<<endl;; while(passport!=passport1) { cout<<"請(qǐng)輸入密碼:"; cin>>passport;cout<<"請(qǐng)?jiān)俅屋斎朊艽a:";cin>>passport1; } cout<<"請(qǐng)輸入您旳姓名:"; cin>>name; } ofstreamstoreFile("userdate.txt",ios::app); storeFile<<setiosflags(ios::left)<<setw(15)<<username<<"" <<setw(15)<<passport<<""<<setw(10)<<name<<endl; storeFile.close(); system("cls"); cout<<"賬戶創(chuàng)立成功!歡迎您,"<<name<<endl; system("pause"); system("cls"); first_face(); choice();}voidcall()//提醒功能{ system("cls"); ifstreamstoreFile("store.txt"); boolflag=false; stringname1;//商品名 doubleprice1;//價(jià)格 stringstoreN
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 福建省福州市九校聯(lián)考2025-2026學(xué)年七年級(jí)上學(xué)期期中語(yǔ)文試題(含答案)(含解析)
- 2026年行政人員職業(yè)素養(yǎng)進(jìn)階培訓(xùn)
- 2026福建中醫(yī)藥大學(xué)附屬人民醫(yī)院招聘非在編合同制人員40人備考題庫(kù)(一)完整參考答案詳解
- 城市公共停車場(chǎng)管理手冊(cè)
- 2026年農(nóng)業(yè)科技創(chuàng)新成果轉(zhuǎn)化路徑
- 職業(yè)噪聲與心血管疾病精準(zhǔn)預(yù)防策略
- 口腔種植技術(shù)年終總結(jié)(3篇)
- 2022~2023初級(jí)護(hù)師考試題庫(kù)及答案第653期
- 中國(guó)北京科學(xué)院科技戰(zhàn)略咨詢研究院2022年招聘人員試題及答案解析1
- 職業(yè)健康遠(yuǎn)程隨訪的醫(yī)患協(xié)同管理策略優(yōu)化
- 2025北京西城區(qū)初一(下)期末英語(yǔ)試題及答案
- 2026.01.01施行的《招標(biāo)人主體責(zé)任履行指引》
- DB11∕T 689-2025 既有建筑抗震加固技術(shù)規(guī)程
- 2025年湖南公務(wù)員《行政職業(yè)能力測(cè)驗(yàn)》試題及答案
- 提前招生面試制勝技巧
- 2024中國(guó)類風(fēng)濕關(guān)節(jié)炎診療指南課件
- 2026年中國(guó)家居行業(yè)發(fā)展展望及投資策略報(bào)告
- 陜西省西安鐵一中2026屆高一物理第一學(xué)期期末教學(xué)質(zhì)量檢測(cè)試題含解析
- DB3207∕T 1046-2023 香菇菌棒生產(chǎn)技術(shù)規(guī)程
- 2025-2030腦機(jī)接口神經(jīng)信號(hào)解碼芯片功耗降低技術(shù)路線圖報(bào)告
- 空調(diào)安裝應(yīng)急預(yù)案
評(píng)論
0/150
提交評(píng)論