OOP · Terminal · 2025
C++ Console Mini-Suite
Three console programs written to make OOP stop being vocabulary and start being a tool.
3
programs, one shared core
100%
input paths validated
C++17
standard, no libraries
banking.cpp — sample session
$ ./banking ── Mini Banking System ───────────── 1) Deposit 2) Withdraw 3) Balance 4) Exit > 1 Amount: 2500 ✔ Deposited ₹2500. New balance: ₹7,300 > 2 Amount: 9000 ✘ Insufficient funds. Balance: ₹7,300 > 3 Balance: ₹7,300 > 4 Session closed. Goodbye 👋
The problem
Classroom C++ is syntax drills. I wanted programs where a bad design decision actually hurts — where state, validation and control flow have to be arranged properly or the thing breaks.
Constraints
- Standard library only — no external dependencies, must compile with a plain g++ invocation.
- Every user input is hostile until validated.
What I built
- Tic-Tac-Toe: board represented as a flat array, win/tie detection via line masks rather than nested conditionals.
- Mini Banking System: an Account class owning its invariants — balance can never go negative, and the check lives inside the class, not the menu loop.
- Rock-Paper-Scissors with seeded RNG and a running score.
- A shared input helper that re-prompts on non-numeric or out-of-range entry instead of silently accepting garbage.
Trade-offs
Invariants inside the class, not the menu
The first version validated in the UI loop. Adding a second entry point instantly duplicated the rule — the classic reason encapsulation exists.
Line masks over nested if-chains for win detection
Eight conditions became one loop, and the bug I had in the diagonal case disappeared with it.
Outcome
- Every invalid input path handled — the programs cannot be crashed from the keyboard.
- First time I refactored my own code because the design was wrong, not because it failed.
Stack
C++17STLg++
Want the long version?
Happy to walk through the decisions live.