A lightweight and scalable C++ console application featuring core banking functionalities with structured data storage in JSON and CSV.
β
Create Accounts (Savings & Current)
β
View Account Details
β
Modify Account (Name & Type)
β
Deposit & Withdraw Money
β
Delete Account
β
Save & Load Data in JSON
β
Export Data to CSV
- Installation & Setup
- Usage Guide
- File & Directory Structure
- Code Explanation
- Data Storage Formats
- Error Handling
- Contribution Guidelines
- License
- Credits & Authors
- C++ Compiler (GCC, Clang, MSVC, etc.)
- C++17 or later
- JSON Library (nlohmann/json)
1οΈβ£ Clone the Repository:
git clone https://github.com/kreeeesh17/bank-managment-system.git
cd bank-management-system
2οΈβ£ Compile the Code:
g++ -o bank main.cpp src/user.cpp -std=c++17 -Iinclude
OR
make
3οΈβ£ Run the Program:
./bank
OR
make run
4οΈβ£ Clear the Database and Executables after use:
make clean
- The system prompts for Name and Account Type (Savings/Current).
- Generates a unique account number based on the date and a counter.
1. Enter your account number.
2. See Number, Name, Balance, and Type.
1. Enter account number.
2. Enter deposit amount.
3. Balance updates automatically.
1. Enter account number.
2. Enter withdrawal amount.
3. If sufficient balance β Success.
4. If not β Error message.
1. Enter account number.
2. Change Name & Account Type.
3. Data is saved instantly.
1. Enter account number.
2. Confirm deletion.
3. Account is removed from JSON file.
1. Select CSV export option.
2. Data saved in `data/accounts.csv`.
Bank Management System/
β
βββ .gitignore # Specifies files and directories that should be ignored by Git
βββ LICENSE # Open-source MIT license for the project
βββ README.md # Project description, installation, usage, and details
βββ Makefile # Instructions for building and cleaning the project
βββ build/ # Directory for future build artifacts (currently empty)
β
βββ data/ # Directory containing data files (accounts.json, accounts.csv)
β βββ accounts.json
β βββ accounts.csv
β
βββ include/ # Header files
β βββ json.hpp # JSON library (external)
β βββ user.h # User class definition
β
βββ src/ # Source files
β βββ user.cpp # User class implementation
β
βββ main.cpp # Main program entry point
βββ bin/ # (Optional) Directory for executables (not used directly in this setup)
- Private Members
account_number
,user_name
,account_balance
,account_type
- Public Methods
createAccount()
β Takes user input & generates account.displayAccount()
β Prints details of the account.deposit(double amount)
β Adds money to the account.withdraw(double amount)
β Deducts money from the account.modifyAccount()
β Changes name & type of the account.deleteAccount()
β Removes account data from the storage.toJson()
β Converts the user object to a JSON format.saveToJson()
β Saves all accounts todata/accounts.json
.loadFromJson()
β Reads account data from JSON and updates theusers
list.exportToCSV()
β Exports all account data todata/accounts.csv
.
- Returns the current date in
YYYYMMDD
format, which is used to generate unique account numbers by combining it with a static counter.
- A static counter is used to generate unique account numbers. This ensures that each account number is distinct and incremented automatically with every new account creation.
[
{
"account_number": "0000202502261",
"user_name": "John Doe",
"account_balance": 1000.50,
"account_type": "Savings"
}
]
Account Number,Name,Balance,Type
0000202502261,John Doe,1000.50,Savings
β Invalid Inputs β If incorrect data is entered, prompts reappear for correction.
β Insufficient Balance β Withdrawals are blocked if the account has insufficient funds.
β File Errors β If JSON/CSV files fail to open, errors are displayed.
-
Memory Efficiency
β Uses a globalvector<User>
to store all users, avoiding redundant data loading.
β A static counter for unique account number generation ensures efficient handling without conflicts. -
Modern C++ Practices
β Structured serialization of objects using nlohmann/json.
β RAII principles: Destructor ensures proper memory management.
β No raw pointersβuses smart memory management. -
Scalability & Maintainability
β Enum-based account types: Future-proof design with extendable account types.
β Globalunordered_map<Type, std::string>
allows for efficient lookup of account types.
β The code avoids dependency on compiler-specific features, ensuring broader compatibility. -
Performance Not Sacrificed
β Efficient handling of large datasets using JSON for storage.
β Optimized file I/O with stream-based handling of file operations.
β
Fork the repository.
β
Make changes in a separate branch.
β
Submit a pull request (PR) with a proper description of your changes.
This project is open-source under the MIT License.
π¨βπ» Developed By: Kreesh Modi
π IIT Kharagpur | Mechanical Engineering