shangcheng/README.md

45 lines
1.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# MallSystem —— 简约商城系统
## 概述
使用 C++17 编写的控制台商城模拟系统,包含三大核心模块:
- **商品管理**Product商品名称、价格、库存
- **购物车**ShoppingCart添加/移除商品、计算总价
- **订单管理**Order从购物车生成订单、查看订单状态
## 构建与运行
```bash
# 构建
cmake -B build
cmake --build build
# 运行主程序
./build/mall
# 运行测试
./build/mall_test
```
## 工程结构
```
.
├── CMakeLists.txt
├── README.md
├── include/
│ ├── app.hpp # 应用入口封装
│ ├── product.hpp # 商品类
│ ├── shopping_cart.hpp # 购物车类
│ └── order.hpp # 订单类
├── src/
│ ├── main.cpp # 命令行入口
│ ├── app.cpp # 应用逻辑
│ ├── product.cpp # 商品实现
│ ├── shopping_cart.cpp # 购物车实现
│ └── order.cpp # 订单实现
└── tests/
└── basic_test.cpp # 单元测试assert
```