




版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、C+刑序設(shè)計(jì)用K擬試卷(一)C+閡寫(xiě)倉(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();
2、voidselect_ele();voidselect_name();voidselect_kind();voidselect_all();voidcall();voiddenglu()stringusername1,passport1,name1;stringusername,passport;ifstreamstoreFile("userdate.txt");if(!storeFile)cout<<"nnt對(duì)不起,用戶文件丟失。nnt"system("pause");return;cout<<”用戶登錄:&
3、quot;<<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<<”登錄成功!
4、"<<endl;cout<<"歡迎您,"<<name1<<"A_A"<<endl;system("pause");elseif(username1=username|passport1=passport) coutvv”用戶名或密碼錯(cuò)誤!"<<endl;denglu();storeFile.close();call();choice();voidchoice()chara;a=first_face();while(1)switch(a)case
5、'1':in_storage();break;case'2':out_storage();break;case'3':select_ele();break;case'4':system("cls");cout<<"t 謝謝您的使用!nntt"exit(0);break;defaultbreak;charfirst_face()cout<<"system("cls");/系統(tǒng)消屏="<<endl;cout<<
6、;"*"<<endl;cout<<"*倉(cāng)庫(kù)管理系統(tǒng)*"<<endl;cout<<"*"<<endl;cout<<"*1.商品入庫(kù)*"<<endl;cout<<"*"<<endl;cout<<"*2.商品出庫(kù) *"<<endl;cout<<"*"<<endl;cout<<"*3.商品
7、查詢 *"<<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)str
8、ingkinds;/ 商品大類stringshelfNo;/ 貨架號(hào)longcount=0;/ 商品數(shù)量stringtime;/入庫(kù)時(shí)間cout<<"n"頁(yè)腳內(nèi)容3C+刑序設(shè)計(jì),K擬試卷(一)頁(yè)腳內(nèi)容5cout<<"商品入庫(kù),請(qǐng)輸入相關(guān)信息:H.cout<<endl<<"t商品名稱:"cin>>name;cout<<endl<<"t商品價(jià)格:"cin>>price;cout<<endl<<"t商品
9、數(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í)間(例如:2014.01.01 ):"cin>>time;ofstreamstoreFile(&
10、quot;store.txt",ios:app);storeFile<<setiosflags(ios二left)<<setw(20)<<name<<“"<<setw(15)<<price<<""<<setw(10)<<count<<""<<setw(10)<<storeNo<<""<<setw(20)<<kinds<<&qu
11、ot;"<<shelfNo<<""<<setw(20)<<time<<endl;storeFile.close();cout<<"nnt該商品已經(jīng)入庫(kù)nnt"cout<<"是否繼續(xù)? 1.是 2.否"<<endl;inta;cin>>a;if(a=1)in_storage();C+刑序設(shè)計(jì)用K擬試卷(一)頁(yè)腳內(nèi)容7if(a=2)first_face();choice();system("pause"
12、);系統(tǒng)暫停/出庫(kù)voidout_storage()system("cls");/系統(tǒng)消屏<<endl;stringname;/ 商品名cout<<endl<<"t 商品出庫(kù),輸入出庫(kù)商品信息:cout<<"nt 商品名稱:"cin>>name;ifstreamstoreFile("store.txt");if(!storeFile)ofstreamstoreFile1("store.txt");storeFile1.close();cout&l
13、t;<"nnt 庫(kù)存為空nnt"cout<<”是否繼續(xù)? 1.是 2.否"<<endl;inta;cin>>a;if(a=1)in_storage();elseif(a=2)first_face();choice();)boolflag=false;stringnamel;/ 商品名doublepricel;/ 價(jià)格stringstoreNo1;/倉(cāng)庫(kù)編號(hào)stringkinds1;/ 商品大類stringshelfNo1;/ 貨架號(hào)longcount1=0;/商品數(shù)量ofstreamtempFile("temp.
14、txt");while(storeFile>>name1>>price1>>count1>>storeNo1>>kinds1>>shelfNo1)if(name1=name)flag=true;elsetempFile<<setiosflags(ios二left)<<setw(20)<<name1<<""<<setw(15)<<price1<<""<<setw(10)<&l
15、t;count1<<""<<setw(10)<<storeNo1<<""<<setw(20)<<kinds1<<""<<shelfNo1<<endl;tempFile.close();storeFile.close();if(!flag)C+刑序設(shè)計(jì),K擬試卷(一)cout<<"nnt倉(cāng)庫(kù)中沒(méi)有該商品! nnt"system("pause");return;ofstreamst
16、oreFile1("store.txt");ifstreamtempFile1("temp.txt");storeFile1<<tempFile1.rdbuf();storeFile1.close();tempFile1.close();cout<<"nt 這些商品已經(jīng)出庫(kù),請(qǐng)仔細(xì)檢查! ! nnt"cout<<”是否繼續(xù)? 1.是 2.否"<<endl;inta;cin>>a;if(a=1)out_storage();if(a=2)first_face();cho
17、ice();system("pause");/查詢voidselect_ele()while(1)system("cls");cout<<"n"<<endl;cout<<"t="<<endl<<"t"<<endl<<"t商品查詢"<<endl<<"t"<<endl<<"t1.按商品名稱查詢"<<
18、endl<<"t"<<endl<<"t2.按入庫(kù)時(shí)間查詢"<<endl<<"t"<<endl<<"t3.查看所有商品"<<endl<<"t"<<endl<<"t4.按商品大類查詢"<<endl<<"t"<<endl<<"t5.返回"<<endl&l
19、t;<"t"<<endl<<"t="<<endl;cout<<"ntt"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();ch
20、oice();break;default:break;頁(yè)腳內(nèi)容9C+刑序設(shè)計(jì),K擬試卷(一)/按商品名稱查詢voidselect_name()system("cls");cout<<endl<<"t按商品名查詢:"<<endl;cout<<"nt 輸入商品名:"stringname;cin>>name;stringnamel;/ 商品名stringtimel;doublepricel;/ 價(jià)格stringstoreNol;/ 倉(cāng)庫(kù)編號(hào)stringkindsl;/ 商品大類st
21、ringshelfNo1;/ 貨架號(hào)longcount1=0;/ 商品數(shù)量ifstreamstoreFile("store.txt");if(!storeFile)cout<<"nnt 對(duì)不起,你的庫(kù)存為空nnt"system("pause");return;boolflag=false; cout<<"n 商品名"<<"價(jià)格"<<"商品數(shù)量"<<"倉(cāng)庫(kù)編號(hào)"<<"商品大類&
22、quot;<<"貨架號(hào)"<<"入庫(kù)時(shí)間"<<endl;while(storeFile>>name1>>price1>>count1>>storeNo1>>kinds1>>shelfNo1>>time1) (if(name1=name)(flag=true;cout<<setiosflags(ios:left)<<""<<name1<<""<&l
23、t;price1<<""<<count1<<""<<storeNo1<<""<<kinds1<<""<<shelfNo1<<""<<time1<<endl;storeFile.close();if(!flag)cout<<"nn對(duì)不起,庫(kù)存中沒(méi)有這個(gè)商品 "cout<<"n"<<endl;s
24、ystem("pause");voidselect_time()/按入庫(kù)時(shí)間查詢(system("cls");cout<<"nt按入庫(kù)時(shí)間查詢:"<<endl;cout<<"nt輸入入庫(kù)時(shí)間(例如:2014.01.01):"stringtime;cin>>time;stringnamel;/ 商品名 doublepricel;/ 價(jià)格 stringstoreNol;/倉(cāng)庫(kù)編號(hào)stringkindsl;/ 商品大類 stringshelfNol;/ 貨架號(hào) string
25、time1; longcount1=0;/ 商品數(shù)量 ifstreamstoreFile("store.txt"); if(!storeFile) cout<<"nnt對(duì)不起,你的庫(kù)存為空nnt"system("pause"); return;boolflag=false;cout<<"n 商品名"<<setw(15)<<"價(jià)格"<<setw(10)<<"商品數(shù)量"<<setw(10)<
26、<"倉(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)&
27、lt;<name1<<"" <<setw(10)<<price1<<""<<setw(10)<<count1<<"" <<setw(10)<<storeNo1<<""<<setw(15)<<kinds1<<"" <<shelfNo1<<endl;storeFile.close();if(!flag)cout<
28、;<"nn對(duì)不起,倉(cāng)庫(kù)中沒(méi)有這類商品!"cout<<"n"<<endl;system("pause");voidselect_all()查看所有商品system("cls");stringnamel;/ 商品名stringtimel;/入庫(kù)時(shí)間doublepricel;/ 價(jià)格stringstoreNol;/倉(cāng)庫(kù)編號(hào)stringkinds1;/ 商品大類stringshelfNo1;/ 貨架號(hào)longcount1=0;/ 商品數(shù)量ifstreamstoreFile("stor
29、e.txt");if(!storeFile)cout<<"nnt對(duì)不起,你的庫(kù)存為空nnt"system("pause");return;boolflag=false; cout<<"n 商品名"<<"價(jià)格"<<"商品數(shù)量"<<"倉(cāng)庫(kù)編號(hào)"<<"商品大類"<<"貨架號(hào)"<<"入庫(kù)時(shí)間"<<endl;w
30、hile(storeFile>>name1>>price1>>count1>>storeNo1>>kinds1>>shelfNo1>>time1) (flag=true;cout<<setiosflags(ios:left)<<""<<name1<<""<<price1<<""<<count1<<""<<storeNo1<
31、;<""<<kinds1<<""<<shelfNo1<<""<<time1<<endl;storeFile.close();system("pause");/按大類查詢voidselect_kind()(system("cls");cout<<"nt按商品大類查詢:"<<endl;cout<<"nt輸入大類名:"stringkinds;cin&
32、gt;>kinds;stringname1;/ 商品名doubleprice1;/ 價(jià)格stringstoreNo1;/倉(cāng)庫(kù)編號(hào)stringkinds1;/ 商品大類stringshelfNo1;/ 貨架號(hào)頁(yè)腳內(nèi)容13C+刑序設(shè)計(jì)用K擬試卷(一)stringtimel;/ 入庫(kù)時(shí)間longcount1=0;/商品數(shù)量ifstreamstoreFile("store.txt");if(!storeFile)cout<<"nnt對(duì)不起,你的庫(kù)存為空nnt"system("pause");return;boolflag=f
33、alse;cout<<"n 商品名"<<"價(jià)格"<<"商品數(shù)量"<<"倉(cāng)庫(kù)編號(hào)"<<"商品大類"<<"貨架號(hào)"<<"入庫(kù)時(shí)間"<<endl;while(storeFile>>name1>>price1>>count1>>storeNo1>>kinds1>>shelfNo1>>ti
34、me1) if(kinds1=kinds)flag=true;cout<<setiosflags(ios:left)<<setw(15)<<name1<<""<<setw(10)<<price1<<""<<setw(10)<<count1<<""<<setw(10)<<storeNo1<<""<<setw(15)<<kinds1<&
35、lt;""<<shelfNo1<<""<<setw(15)<<time1<<endl;storeFile.close();if(!flag)cout<<"nn對(duì)不起,庫(kù)存中沒(méi)有這類商品 "cout<<"n"<<endl;system("pause");voidzhuce()system("cls");/系統(tǒng)消屏stringusername,passport,passport1,na
36、me,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)重新輸入!&quo
37、t;<<endl;while(passport!=passport1)cout<<"請(qǐng)輸入密碼:"cin>>passport;cout<<"請(qǐng)?jiān)俅屋斎朊艽a:"cin>>passport1;頁(yè)腳內(nèi)容15C+刑序設(shè)計(jì)用K擬試卷(一)H.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");sys
溫馨提示
- 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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025至2031年中國(guó)多功能無(wú)壓生產(chǎn)茶爐行業(yè)投資前景及策略咨詢研究報(bào)告
- 2025至2031年中國(guó)全棉雪尼爾沙發(fā)墊行業(yè)投資前景及策略咨詢研究報(bào)告
- 2025至2031年中國(guó)二次電池手動(dòng)化成機(jī)行業(yè)投資前景及策略咨詢研究報(bào)告
- 2025至2030年中國(guó)音頻放大器數(shù)據(jù)監(jiān)測(cè)研究報(bào)告
- 2025至2030年中國(guó)預(yù)制型電力電纜終端接頭數(shù)據(jù)監(jiān)測(cè)研究報(bào)告
- 2025至2030年中國(guó)隔膜壓力表數(shù)據(jù)監(jiān)測(cè)研究報(bào)告
- 2025至2030年中國(guó)網(wǎng)絡(luò)電話系統(tǒng)數(shù)據(jù)監(jiān)測(cè)研究報(bào)告
- 2025至2030年中國(guó)紫外熒光油墨數(shù)據(jù)監(jiān)測(cè)研究報(bào)告
- 2025至2030年中國(guó)竹編工藝籃子數(shù)據(jù)監(jiān)測(cè)研究報(bào)告
- 2025至2030年中國(guó)電刨刀片數(shù)據(jù)監(jiān)測(cè)研究報(bào)告
- 2025年度劇本殺劇本版權(quán)授權(quán)與收益分成合同
- 2025年春季學(xué)期學(xué)校工作計(jì)劃及安排表
- 2025年一種板式過(guò)濾膜裝置項(xiàng)目投資可行性研究分析報(bào)告
- 2024新版《藥品管理法》培訓(xùn)課件
- 浙江省杭州市2024年中考英語(yǔ)真題(含答案)
- 《陸上風(fēng)電場(chǎng)工程設(shè)計(jì)概算編制規(guī)定及費(fèi)用標(biāo)準(zhǔn)》(NB-T 31011-2019)
- 2024初中數(shù)學(xué)課程標(biāo)準(zhǔn)測(cè)試題(含答案)精華版
- 2024年陜西延長(zhǎng)石油集團(tuán)礦業(yè)公司招聘筆試參考題庫(kù)含答案解析
- 減數(shù)分裂過(guò)程圖
- “太平官”“老爺官”“懶散官”專項(xiàng)治理自查報(bào)告
- 汽輪機(jī)超速事故及預(yù)防
評(píng)論
0/150
提交評(píng)論