收藏 分销(赏)

酒店库存管理代码模板.doc

上传人:天**** 文档编号:2684680 上传时间:2024-06-04 格式:DOC 页数:15 大小:35.54KB 下载积分:8 金币
下载 相关 举报
酒店库存管理代码模板.doc_第1页
第1页 / 共15页
酒店库存管理代码模板.doc_第2页
第2页 / 共15页


点击查看更多>>
资源描述
//main.cpp #include <iostream> #include <string> #include <fstream> #include <cassert> #include <iomanip> #include <conio.h> using namespace std; //仓库管理员类 class admin { public: admin(); private: string name; }; //仓库货架类 class shelf { public: shelf(); private: admin men;//管理员 string storeNo;//仓库编号 string kinds;//商品大类 string shelfNo;//货架号 }; //电器类 class ele { public: ele(); private: string name;//商品名 double price;//介格 shelf sh;//所属货架 long count;//商品数量 }; //管理(组合类) class mana { public: mana(); char first_face();//首页 void in_storage();//入库 void out_storage();// 出库 void select_ele();//查询 void select_name();//按商品名称查询 void select_price();//按商品价格查询 void select_kind();//按大类查询 void call_break();//商品报损 private: ele aele; shelf ashelf; admin abs; }; //电器类默认结构函数 ele::ele():sh() { name = "xxx";//商品名 price = 0.0;//介格 count = 0;//商品数量 } // //仓库货架类默认结构函数 shelf::shelf():men() { storeNo = "xxx";//仓库编号 kinds = "xxx";//商品大类 shelfNo = "xxx";;//货架号 } //仓库管理员类 admin::admin() { name = "xxx"; } //管理类默认结构函数 mana::mana():aele(), ashelf(), abs() { } char mana::first_face() { system("cls"); cout << endl; cout <<endl <<"\t\t◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆" <<endl <<"\t\t◆ ◆" <<endl <<"\t\t◆ 商场电器库存管理系统 ◆" <<endl <<"\t\t◆ ◆" <<endl <<"\t\t◆ 1. 商品入库 ◆" <<endl <<"\t\t◆ ◆" <<endl <<"\t\t◆ 2. 商品出库 ◆" <<endl <<"\t\t◆ ◆" <<endl <<"\t\t◆ 3. 查询统计 ◆" <<endl <<"\t\t◆ ◆" <<endl <<"\t\t◆ 4. 商品报损 ◆" <<endl <<"\t\t◆ ◆" <<endl <<"\t\t◆ 5. 退出系统 ◆" <<endl <<"\t\t◆ ◆" <<endl <<"\t\t◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆" <<endl <<endl <<"\t\t"; return getch(); } //入库 void mana::in_storage() { system("cls"); string name;//商品名 double price;//介格 string storeNo;//仓库编号 string kinds;//商品大类 string shelfNo;//货架号 long count = 0; //商品数量 cout << endl << "商品入库,请输入相关信息 : " << endl << endl ; cout << "\t商品名称 : "; cin >> name; cout << endl << "\t商品介格 : "; cin >> price; cout << endl << "\t商品数量 : "; cin >> count; cout << endl << "\t仓库编号 : "; cin >> storeNo; cout << endl << "\t商品大类 : "; cin >> kinds; cout << endl << "\t货架编号 : " ; cin >> shelfNo; ofstream storeFile("store.txt", ios::app); storeFile << setiosflags(ios::left) << setw(20) << name << " " << setw(15) << price << " " << setw(10) << count << " " << setw(10) << storeNo << " " << setw(20) << kinds << " " << shelfNo << endl; storeFile.close(); cout << endl << endl << "\t该商品已经入库......." << endl << endl << "\t"; system("pause"); } // 出库 void mana::out_storage() { system("cls"); string name;//商品名 cout << endl << "\t商品出库,输入出库商品信息 : " << endl << endl; cout << "\t商品名称 : "; cin >> name; ifstream storeFile("store.txt"); if (!storeFile) { ofstream storeFile1("store.txt"); storeFile1.close(); cout << endl << endl << "\t仓存为空!!!!" << endl << endl << "\t"; system("pause"); return; } bool flag = false; string name1;//商品名 double price1;//介格 string storeNo1;//仓库编号 string kinds1;//商品大类 string shelfNo1;//货架号 long count1 = 0; //商品数量 ofstream tempFile("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 << endl << endl << "\t仓库中没有这种商品!!!" << endl << endl << "\t"; system("pause"); return; } ofstream storeFile1("store.txt"); ifstream tempFile1("temp.txt"); storeFile1 << tempFile1.rdbuf(); storeFile1.close(); tempFile1.close(); cout << endl << "\t这些商品已经出库, 请仔细检验!!!" << endl << endl << "\t"; system("pause"); } //查询 void mana::select_ele() { while (1) { system("cls"); cout << endl << endl; cout << "\t=============================================================" << endl << "\t|| ||" << endl << "\t|| 商 品 查 询 ||" << endl << "\t|| ||" << endl << "\t|| 1. 按商品名称查询 ||" << endl << "\t|| ||" << endl << "\t|| 2. 按商品价格查询 ||" << endl << "\t|| ||" << endl << "\t|| 3. 按大类查询 ||" << endl << "\t|| ||" << endl << "\t|| 4. 返回 ||" << endl << "\t|| ||" << endl << "\t=============================================================" << endl << endl << "\t\t"; char select = getch(); switch (select) { case '1': select_name(); break; case '2': select_price(); break; case '3': select_kind(); break; case '4': return; default: break; } } } //按商品名称查询 void mana::select_name() { system("cls"); cout << endl << "\t按商品名查询 : " << endl << endl ; cout << "\t输入商品名 : "; string name; cin >> name; string name1;//商品名 double price1;//介格 string storeNo1;//仓库编号 string kinds1;//商品大类 string shelfNo1;//货架号 long count1 = 0; //商品数量 ifstream storeFile("store.txt"); if (!storeFile) { cout << endl << endl << "\t对不起,你库存为空!!!" << endl << endl << "\t"; system("pause"); return; } bool flag = false; cout << endl << "商品名 " << "介格 " << "商品数量 " << "仓库编号 " << "商品大类 " << "货架号" << endl << endl; while (storeFile >> name1 >> price1 >> count1 >> storeNo1 >> kinds1 >> shelfNo1) { if (name1 == name) { 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 << endl << endl << "对不起,库存中没有这种商品!!!"; cout << endl << endl; system("pause"); } //按商品价格查询 void mana::select_price() { system("cls"); cout << endl << "\t按商品价格查询 : " << endl << endl ; cout << "\t输入价格 : "; double price; cin >> price; string name1;//商品名 double price1;//介格 string storeNo1;//仓库编号 string kinds1;//商品大类 string shelfNo1;//货架号 long count1 = 0; //商品数量 ifstream storeFile("store.txt"); if (!storeFile) { cout << endl << endl << "\t对不起,你库存为空!!!" << endl << endl << "\t"; system("pause"); return; } bool flag = false; cout << endl << "商品名 " << "介格 " << "商品数量 " << "仓库编号 " << "商品大类 " << "货架号" << endl << endl; while (storeFile >> name1 >> price1 >> count1 >> storeNo1 >> kinds1 >> shelfNo1) { if (price1 == price) { 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 << endl << endl << "对不起,库存中没有这个价格商品!!!"; cout << endl << endl; system("pause"); } //按大类查询 void mana::select_kind() { system("cls"); cout << endl << "\t按商品大类查询 : " << endl << endl ; cout << "\t输入大类名 : "; string kinds; cin >> kinds; string name1;//商品名 double price1;//介格 string storeNo1;//仓库编号 string kinds1;//商品大类 string shelfNo1;//货架号 long count1 = 0; //商品数量 ifstream storeFile("store.txt"); if (!storeFile) { cout << endl << endl << "\t对不起,你库存为空!!!" << endl << endl << "\t"; system("pause"); return; } bool flag = false; cout << endl << "商品名 " << "介格 " << "商品数量 " << "仓库编号 " << "商品大类 " << "货架号" << endl << endl; while (storeFile >> name1 >> price1 >> count1 >> storeNo1 >> kinds1 >> shelfNo1) { 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 << endl; } } storeFile.close(); if (!flag) cout << endl << endl << "对不起,库存中没有这类商品!!!"; cout << endl << endl; system("pause"); } //商品报损 void mana::call_break() { system("cls"); string name;//商品名 cout << endl << "\t商品报损,请输入要报损商品信息 : " << endl << endl; cout << "\t商品名称 : "; cin >> name; ifstream storeFile("store.txt"); if (!storeFile) { ofstream storeFile1("store.txt"); storeFile1.close(); cout << endl << endl << "\t仓存为空!!!!" << endl << endl << "\t"; system("pause"); return; } bool flag = false; string name1;//商品名 double price1;//介格 string storeNo1;//仓库编号 string kinds1;//商品大类 string shelfNo1;//货架号 long count1 = 0; //商品数量 ofstream tempFile("temp.txt"); cout << endl << endl << "你想报损商品信息以下 : " << endl << endl; cout << endl << "商品名 " << "介格 " << "商品数量 " << "仓库编号 " << "商品大类 " << "货架号" << endl << endl; while (storeFile >> name1 >> price1 >> count1 >> storeNo1 >> kinds1 >> shelfNo1) { if (name1==name) { flag = true; cout << setiosflags(ios::left) << setw(15) << name1 << " " << setw(10) << price1 << " " << setw(10) << count1 << " " << setw(10) << storeNo1 << " " << setw(15) << kinds1 << " " << shelfNo1 << endl; shelfNo1 += "(损坏)"; } 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 << endl << endl << "对不起,仓库中没有这种商品!!!" << endl << endl; system("pause"); return; } ofstream storeFile1("store.txt"); ifstream tempFile1("temp.txt"); storeFile1 << tempFile1.rdbuf(); storeFile1.close(); tempFile1.close(); cout << endl << endl << "这些商品已经损坏,请立即从仓库中取出!!!" << endl << endl; cout << "报损成功,统计已经更改!!!" << endl << endl ; system("pause"); } int main() { char select; mana men; while (select = men.first_face()) { switch (select) { case '1': men.in_storage(); break; case '2': men.out_storage(); break; case '3': men.select_ele(); break; case '4': men.call_break(); break; case '5': cout << "\t" << "谢谢使用!!!!" << endl << endl << "\t\t"; exit( 0 ); break; default: break; } } return 0; }
展开阅读全文

开通  VIP会员、SVIP会员  优惠大
下载10份以上建议开通VIP会员
下载20份以上建议开通SVIP会员


开通VIP      成为共赢上传

当前位置:首页 > 行业资料 > 酒店餐饮

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        抽奖活动

©2010-2026 宁波自信网络信息技术有限公司  版权所有

客服电话:0574-28810668  投诉电话:18658249818

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :微信公众号    抖音    微博    LOFTER 

客服