利用c++做的课程设计(链表),在DEV C++等编译器上可通过
运行完毕后可自动保存信息输出文件
觉得还可以的话请点赞收藏哦
#include<iostream>
#include<fstream>
#include<string>
#include<iomanip>
#include<windows.h>
using namespace std;
enum GoodsType//商品类别
{
Food=1,//食品
Cosmetic,//化妆品
Commodity,//日用品
Drink//饮料
};
struct Date
{
int year;
int month;
int day;
};
struct Goods//商品基本信息
{
string code;//商品编号
string name;//商品名称
string brand;//生产厂家
double price;//商品价格
int num;//商品数量
GoodsType type;//商品类别
Date date;//入库时间
Goods *next;
};
class GoodsManage//商品管理
{
public:
GoodsManage();
~GoodsManage(){}
void DisplayMainMenu();//主菜单显示
void AddGoodsInfo();//添加商品信息
void DisplayGoodsInfo();//浏览商品信息
void SearchByCode();//按照商品编号搜索商品信息
void SearchByName();//按照商品名称搜索商品信息
void DeleteGoodsInfo();//删除商品信息
void SellGoodsInfo();//出售商品信息
void SaveGoodsInfo();//保存商品信息
private:
int amount;//商品量
int DeleteAmount;
Goods *head;
Goods *DeleteHead;
};
GoodsManage::GoodsManage()//定义构造函数
{
amount=0;
DeleteAmount=0;
head=new Goods;
head->next=NULL;
DeleteHead=new Goods;
DeleteHead->next=NULL;
}
void GoodsManage::DisplayMainMenu()//定义主菜单函数
{
cout<<" ━═☆┈━═☆┈━═☆┈━═☆┈━═☆┈━═☆┈━═☆┈━═☆━═☆\n";
cout<<" ┋ ┋\n";
cout<<" ┋ 欢迎使用商品库存管理系统 ┋\n";
cout<<" ┋ ┋\n";
cout<<" ┋ ┋\n";
cout<<" ┋ 【商品进货】…(a) ┋\n";
cout<<" ┋ ┋\n";
cout<<" ┋ 【商品编辑】…(b) ┋\n";
cout<<" ┋ ┋\n";
cout<<" ┋ 【商品删除】…(c) ┋\n";
cout<<" ┋ ┋\n";
cout<<" ┋ 【按照编号查询】…(d) ┋\n";
cout<<" ┋ ┋\n";
cout<<" ┋ 【按照名称查询】…(e) ┋\n";
cout<<" ┋ ┋\n";
cout<<" ┋ 【商品出货】…(h) ┋\n";
cout<<" ┋ ┋\n";
cout<<" ┋ 【商品统计】…(i) ┋\n";
cout<<" ┋ ┋\n";
cout<<" ┋ 【信息保存】…(j) ┋\n";
cout<<" ┋ ┋\n";
cout<<" ┋ ┋\n";
cout<<" ┋ 退出系统…(k) ┋\n";
cout<<" ┋ ┋\n";
cout<<" ━═☆┈━═☆┈━═☆┈━═☆┈━═☆┈━═☆┈━═☆┈━═☆━═☆\n";
cout<<"\n