A simple terminal-based simulation program for an online store that manages transactions between buyers and sellers. This program uses C++17 and is built using Meson & Ninja.
- Registration & Login for Buyers and Sellers
- Seller Management: Add and update items in their store
- Buyer Shopping: Browse items and make purchases
- Bank Transactions: Simulated balance transfers between bank accounts
- Order Status Management: Track orders (Paid, Completed, Cancelled)
- Admin Panels: Store and Bank admin menus with basic reporting
- Data Persistence: All data (users, items, orders, bank accounts) is saved to
data/simulation_data.txton exit and loaded on startup
Before you can compile and run this program, ensure you have:
- C++ Compiler: GCC (g++) or Clang with C++17 support
- Meson: Build system (
meson) - Ninja: Build tool (
ninja)
Arch Linux:
sudo pacman -S base-devel meson ninjaUbuntu/Debian:
sudo apt install build-essential meson ninja-buildWindows: Install Python, then:
pip install meson ninjaYou'll also need a C++ compiler (Visual Studio or MinGW).
-
Open terminal in the project root directory
-
Setup Meson (first time only):
meson setup builddir
-
Compile the program:
ninja -C builddir
This creates an executable named
online_store(Linux) oronline_store.exe(Windows) in thebuilddirfolder.
ninja -C builddir run./builddir/online_storeNote: The program will automatically create the data/ folder and simulation_data.txt file if they don't exist. On subsequent runs, it will load previously saved data.
If you want to start fresh with no saved data:
rm -f data/simulation_data.txtonline-store-cpp/
├── meson.build # Meson configuration file
├── main.cpp # Program entry point
├── include/ # Header files (.h)
│ ├── Bank.h
│ ├── BankAccount.h
│ ├── BankTransaction.h
│ ├── Buyer.h
│ ├── Item.h
│ ├── Order.h
│ ├── Seller.h
│ ├── Store.h
│ └── Utils.h
├── src/ # Implementation files (.cpp)
│ ├── Bank.cpp
│ ├── BankAccount.cpp
│ ├── BankTransaction.cpp
│ ├── Buyer.cpp
│ ├── Item.cpp
│ ├── Order.cpp
│ ├── Seller.cpp
│ ├── Store.cpp
│ └── Utils.cpp
├── data/ # Data persistence folder
│ └── simulation_data.txt # Auto-generated data file
├── builddir/ # Build output (created by Meson)
└── README.md # This file
- Login - Login with existing credentials
- Register as Buyer - Create a new buyer account
- Register as Seller - Create a new seller account with a store
- Store Admin Menu - View store-wide reports
- Bank Admin Menu - View bank customer reports
- Exit & Save - Save all data and exit
- Browse all available items
- Purchase items (with bank balance)
- View order history
- Check daily spending
- Manage bank account (deposit/withdraw)
- All buyer features (sellers can also buy)
- Manage store items (add/update)
- View incoming orders
- Update order status
- Discover top K popular items in their store
- View loyal customers
Store Admin:
- View all transactions
- List paid but not completed orders
- View most frequent items
- View most active buyers/sellers
Bank Admin:
- List all bank customers
- View dormant accounts
- View top N most active users today
- View customer transactions
All data is automatically saved to data/simulation_data.txt when you select "Exit & Save" from the main menu. This includes:
- User accounts (buyers and sellers)
- Bank accounts and transaction history
- All items in the store
- All orders and their status
The data is automatically loaded when the program starts.
Program stuck at startup:
- Press Enter to continue past any pause prompts
- Check if
data/folder exists - Try deleting
data/simulation_data.txtto start fresh
Compilation errors:
- Ensure you have C++17 support:
g++ --version(should be 7.0+) - Make sure Meson and Ninja are installed:
meson --version,ninja --version
Menu not displaying properly:
- Some terminals may have issues with screen clearing
- Try running in a different terminal emulator
This project is for educational purposes.
Feel free to fork and submit pull requests for improvements!