Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

🏦 bank-cli — Bank Management System

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.


📑 Table of Contents


📖 Overview

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.


✨ Key Features

👤 User Panel

  • 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).

🛡 Admin Panel

  • 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.

🧰 Tech Stack

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

🏗 System Design

                    BankManagementSystem
      - head (linked list of Account*)
      - AddAccount(), DepositFunds(), WithDrawAmountFromAccount()
      - TakeLoan(), RepayLoan(), SeeTransactionHistory()
      - SaveAccountsToFile(), LoadAccountsFromFile()
      - ConfirmAccountNumber(), ConfirmPassword()
                           ▲
                           │  (public inheritance)
                        Admin
      - AdminPanel(): Freeze / Activate accounts
  • Admin publicly inherits from BankManagementSystem, reusing account storage/lookup while adding the AdminPanel() freeze/activate workflow.
  • main() presents a top-level menu (User Panel / Admin Panel / Exit) and dispatches to admin->Menu() or admin->AdminPanel().

🗃 Data Structures Used

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;
};

💾 Data Persistence

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.


📁 Project Structure

bank-cli/
├── README.md
├── Project.cpp          # Full implementation: BankManagementSystem, Admin, main()
├── AccountsInfo.txt      # Persisted account/transaction data (plain text)
├── Project.exe            # Prebuilt Windows executable

✅ Prerequisites

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).


🚀 Getting Started

1. Clone the repository

git clone https://github.com/<your-username>/bank-cli.git
cd bank-cli

No Git? Click Code → Download ZIP on the GitHub page instead, then extract it and open the extracted folder.

2. Build from source

  1. Confirm you're in the project root (same folder as Project.cpp):
    dir Project.cpp
  2. Compile with g++ (make sure MinGW's bin folder is on your PATH):
    g++ Project.cpp -o Project.exe
  3. Run the compiled program:
    .\Project.exe

Using Visual Studio instead?

  1. Create a new Console App (C++) project.
  2. Replace the default main.cpp with Project.cpp from this repo (add it via Project → Add Existing Item).
  3. Build and run with Ctrl+F5 (Start Without Debugging).

🖥 Usage Walkthrough

  1. Launch the app — choose between User Panel, Admin Panel, or Exit.
  2. 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
    
  3. Admin Panel — on entry, all accounts are listed automatically, then you can choose to Freeze or Activate an account by number.
  4. Account numbers must be 9 digits and passwords 8+ characters; both use masked, character-by-character input via _getch().

🔒 Input Validation Rules

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.


⚠️ Known Limitations

  • 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.txt are skipped with a console message rather than fully recovered.

🔐 Security Note

AccountsInfo.txt in this repo currently contains sample/test account data with plain-text passwords. Before pushing this project publicly:

  • Delete or reset AccountsInfo.txt to 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.txt to .gitignore going 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.

🔮 Possible Future Improvements

  • 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_map keyed 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.

About

A console-based Bank Management System in C++. Create accounts, deposit/withdraw funds, take and repay loans, and view transaction history — all backed by linked lists for accounts and transactions, with data persisted to a text file. Includes an admin panel to freeze/activate accounts. Windows CLI app (conio.h).

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages