This project is a simple financial ledger written in C++. It simulates how basic banking systems manage accounts and record transactions.
The goal of this project was to understand how financial systems track deposits, withdrawals, and transfers while keeping a transaction history for each account.
- Create new accounts
- Deposit and withdraw funds
- Transfer money between accounts
- View account balance
- Maintain transaction history
- Flag unusually large transactions
- O(1) account lookup using unordered_map
Accounts are stored using unordered_map so that account lookup operations like deposits or withdrawals can be performed in constant time.
-C++
-STL (unordered_map, vector)
-Object-Oriented Programming
The system is divided into three main components:
- BankSystem → handles account management and user operations
- BankAccount → stores account balance and transaction history
- Transaction → represents individual operations such as deposits or withdrawals
User Input
│
▼
BankSystem
│
├── BankAccount
│ │
│ └── vector<Transaction>
│
└── Transaction
Each account maintains a vector of transactions so that operations can be recorded in the order they occur.
unordered_map<int, BankAccount>
Used to store accounts and allow fast lookup.
vector<Transaction>
Used to maintain transaction history for each account.
- Modeling real-world systems using object-oriented design
- Using STL containers to manage data efficiently
- Designing modular C++ programs
Compile:
g++ main.cpp -o ledgerRun:
./ledger