A console-based Bank Management System built in C++, featuring account creation, deposits/withdrawals, loans, transaction history, and an admin panel — all backed by a singly linked list of accounts and per-account linked-list transaction logs, with data persisted to a plain text file between runs.
- Overview
- Key Features
- Tech Stack
- System Design
- Data Structures Used
- Data Persistence
- Project Structure
- Prerequisites
- Getting Started
- Usage Walkthrough
- Input Validation Rules
- Known Limitations
- Security Note
- Possible Future Improvements
This project simulates a simplified banking backend from the command line. It supports two access modes:
- A User Panel, where any customer can create an account, deposit/withdraw funds, view transaction history, and take/repay loans.
- An Admin Panel, where accounts can be frozen or reactivated.
All accounts are held in memory as a linked list while the program runs, and are saved to / loaded from a local text file (AccountsInfo.txt) so data survives between sessions.
- Add Account — create a new account with a unique 9-digit account number, name, password, and starting balance.
- Search Account — look up an account by account number + password and view its details.
- Deposit Funds — add money to an account (blocked if the account is frozen).
- Withdraw Funds — withdraw money, with balance-sufficiency checks (blocked if frozen).
- Display All Accounts — list every account with balance, status (Active/Frozen), and loan details.
- See Transaction History — view a full chronological log of deposits/withdrawals for an account.
- Take Loan — request a loan up to a per-account loan limit (default $50,000); approved amount is credited to the balance.
- Repay Loan — repay part or all of an outstanding loan (capped automatically at the outstanding amount and available balance).
- View All Accounts — the admin panel loads and displays every account on entry.
- Freeze Account — lock an account so deposits, withdrawals, and loan actions are blocked.
- Activate Account — unfreeze a previously frozen account.
| Component | Details |
|---|---|
| Language | C++ (uses <stdexcept>, exception handling, <sstream>) |
| Standard Library | <fstream>, <sstream>, <string>, <iomanip>, <ctime> |
| Platform APIs | <conio.h> (Windows-only, masked keystroke input) |
| Interface | Command-Line Interface (CLI) |
| Persistence | Flat text file (AccountsInfo.txt), custom delimiter format |
| Compiler | MinGW g++ / MSVC (Windows) — project includes VS Code settings |
BankManagementSystem
- head (linked list of Account*)
- AddAccount(), DepositFunds(), WithDrawAmountFromAccount()
- TakeLoan(), RepayLoan(), SeeTransactionHistory()
- SaveAccountsToFile(), LoadAccountsFromFile()
- ConfirmAccountNumber(), ConfirmPassword()
▲
│ (public inheritance)
Admin
- AdminPanel(): Freeze / Activate accounts
Adminpublicly inherits fromBankManagementSystem, reusing account storage/lookup while adding theAdminPanel()freeze/activate workflow.main()presents a top-level menu (User Panel / Admin Panel / Exit) and dispatches toadmin->Menu()oradmin->AdminPanel().
| Structure | Purpose |
|---|---|
Singly linked list of Account |
Every account created is appended as a node (Account::next); traversed linearly for lookups, display, and saving. |
Singly linked list of Transaction (per account) |
Each account keeps its own transaction log as a linked list (Transaction::next), appended in chronological order. |
Key structs:
struct Transaction {
string type; // "Deposit" or "Withdraw"
double amount;
string timestamp;
Transaction *next;
};
struct Account {
string AccountNumber;
string AccountName;
double AccountBalance;
bool isFrozen;
string Password;
Transaction *transactionHead = nullptr;
double LoanAmount = 0.0;
double LoanLimit = 50000.0;
Account *next;
};Account and transaction data is written to / read from AccountsInfo.txt in the working directory, using a custom comma/pipe/semicolon-delimited format:
AccountNumber,AccountName,Password,Balance,IsFrozen,LoanAmount,LoanLimit,[Type;Amount;Timestamp|Type;Amount;Timestamp]
- Data is saved automatically after every account-modifying action (add, deposit, withdraw, loan, repayment, freeze/activate) via
SaveAccountsToFile(). - Data is loaded automatically when entering the User Menu or Admin Panel via
LoadAccountsFromFile(). - Loading is idempotent — accounts already present in memory (matched by account number) are skipped rather than duplicated.
⚠️ Passwords are stored here in plain text. See Security Note below before sharing this file or this project publicly.
bank-cli/
├── README.md
├── Project.cpp # Full implementation: BankManagementSystem, Admin, main()
├── AccountsInfo.txt # Persisted account/transaction data (plain text)
├── Project.exe # Prebuilt Windows executable
Because the project uses <conio.h> (for _getch() and masked password input), it must be compiled and run on Windows (natively, or in a Windows VM). It will not compile as-is on Linux/macOS without modification (e.g. swapping conio.h for a portable alternative).
You'll need one of:
- MinGW-w64
g++(recommended, e.g. via MSYS2 or the standalone MinGW installer), or - Microsoft Visual Studio (Desktop development with C++ workload), or
- Any C++ Windows compiler with
<conio.h>support.
You'll also need Git installed if you want to clone the repo (or just download the ZIP from GitHub instead).
git clone https://github.com/<your-username>/bank-cli.git
cd bank-cliNo Git? Click Code → Download ZIP on the GitHub page instead, then extract it and open the extracted folder.
- Confirm you're in the project root (same folder as
Project.cpp):dir Project.cpp
- Compile with
g++(make sure MinGW'sbinfolder is on yourPATH):g++ Project.cpp -o Project.exe
- Run the compiled program:
.\Project.exe
Using Visual Studio instead?
- Create a new Console App (C++) project.
- Replace the default
main.cppwithProject.cppfrom this repo (add it via Project → Add Existing Item). - Build and run with Ctrl+F5 (Start Without Debugging).
- Launch the app — choose between User Panel, Admin Panel, or Exit.
- User Panel menu:
1. Add Account 2. Search Account 3. Deposit Funds 4. Withdraw Funds 5. Display All Accounts 6. See Transaction History 7. Take Loan 8. Repay Loan 9. Exit - Admin Panel — on entry, all accounts are listed automatically, then you can choose to Freeze or Activate an account by number.
- Account numbers must be 9 digits and passwords 8+ characters; both use masked, character-by-character input via
_getch().
| Field | Rule |
|---|---|
| Account Number | Exactly 9 digits, between 100000000 and 999999999, numeric only |
| Password | 8 or more characters |
| Initial Balance | Must be greater than 0 |
| Deposit / Withdraw Amount | Must be greater than 0; withdrawal also checked against available balance |
| Loan Request | Must be > 0 and not push total loan above the account's loan limit |
| Loan Repayment | Must be > 0, capped at both current balance and outstanding loan amount |
Frozen accounts are blocked from deposits, withdrawals, taking loans, and repaying loans.
- Plain-text password storage — passwords are stored and compared as-is, with no hashing (see Security Note).
- No admin authentication — the Admin Panel has no login/PIN of its own; anyone launching the app can access it.
- Linear-time account lookup — accounts are stored in a linked list, so lookups are O(n) rather than using a hash map/index.
- Single-file, single-account-holder data store — no multi-branch, multi-currency, or interest-calculation support.
- Windows-only — relies on
<conio.h>for keystroke capture and masked input. - Basic error handling — malformed lines in
AccountsInfo.txtare skipped with a console message rather than fully recovered.
AccountsInfo.txt in this repo currently contains sample/test account data with plain-text passwords. Before pushing this project publicly:
- Delete or reset
AccountsInfo.txtto remove any real or sample account numbers, names, and passwords — even test data can look like a credential leak to anyone browsing the repo. - Consider adding
AccountsInfo.txtto.gitignoregoing forward, so runtime-generated data never gets committed. - Treat this project as an educational demo of data structures and file I/O, not as a template for handling real financial or personal data — plain-text password storage is not appropriate for anything beyond a classroom exercise.
- Hash passwords (e.g. with a proper cryptographic hash + salt) instead of storing them in plain text.
- Add admin authentication (username/PIN) before granting access to the Admin Panel.
- Replace the linked list with a
map/unordered_mapkeyed by account number for O(1) lookups. - Add interest calculation, account statements, and export to CSV.
- Cross-platform support by replacing
<conio.h>with a portable input library.
Made with ❤️ and a linked list of good intentions.