You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A Bank Management System built using C++, demonstrating concepts like OOP, file handling, and and basic username and password authentication for login as admin.
📌 Features
Admin : Login System (username & password)
Admin : View/Count all accounts
User : Send/Deposit money
Create new bank accounts
Search account by account number
Check account balance
Display account details
File-based data storage (persistent data)
Check balance by account number
Some more operations
✒️ Tech Stack
Language : C++
Concepts Used :
Object-Oriented Programming (OOP)
File Handling (fstream)
Namespaces
Abstract Classes & Virtual Functions
Enum Classes
Structure
📂 Project Structure
bank.cpp : Main source code
data.dat : File storing account records (generated at runtime)
pass : Contains admin login information
README.md : Project documentation
🧠 Design Overview
Namespace: bnk
Core Components:
bank_column : Structure for account data
acc_type : Enum for account type (Saving / Current)
bank_op : Abstract base class for operations
Derived classes implement:
Search account
Check balance
Display account
Admin operations
▶️ How to Run
Compile
g++ bank.cpp -o bank
Run
./bank
If you select option as Admin, Then first time need to set up username and password.
-------------------------------
| WELCOME |
-------------------------------
1.Admin 2.User 3.Exit
-------------------------------
Enter option : 1
-------------------------------
Set username & password
Enter Username : Admin
Enter Password : Pass@123
Details saved successfully
-------------------------------
Enter Admin details to login
-------------------------------
Enter Username : Admin
Enter Password : Pass@123
-------------------------------
Logged In
-------------------------------
1.Create Acc 2.Update Acc
3.Search Acc 4.Delete Acc
5.Check bal 6.Display Accs
7.Count Accs 8.Main menu
-------------------------------
Enter option :
Then using that Login credentials you can login as Admin.
You will get only 3 attempts to Enter correct credentials and If you fail then program terminates with an warning message.
-------------------------------
| WELCOME |
-------------------------------
1.Admin 2.User 3.Exit
-------------------------------
Enter option : 1
Enter Username : Admin
Enter Password : ad
wrong username/password!
-------------------------------
Enter Username : Admin
Enter Password : Pass21
wrong username/password!
Warning: Last attempt remaining!
-------------------------------
Enter Username : Admi
Enter Password : Pass@123
wrong username/password!
-------------------------------
Access blocked :
Too many failed attempts!
-------------------------------
For user, It won't necessary now. May be in future you can see that feature for user as well.
💾 File Handling
data.dat → Stores account details
pass.dat → Stores admin username & password
Ensures data persistence across executions
⚠️ Security Note
Passwords are stored in plain text (binary format)
This means:
Data is not human-readable directly
But can still be easily extracted using programs
❗This is not secure for real-world applications
🔐 Admin Authentication
Admin credentials are stored in a binary file (pass.dat)
Uses istream in binary mode for reading credentials
If you are login first time, then you have to set username and password for admin.
🚀 Future Enhancements
Encrypt passwords (hashing)
Add user login system
Transaction features (deposit/withdraw)
Improve input validation
Add GUI (Qt / Web)
Database integration (MySQL / SQLite)
📸 Sample Flow/Output
ADMIN
bruce@Bruce:~/project$ ./bank
-------------------------------
| WELCOME |
-------------------------------
1.Admin 2.User 3.Exit
-------------------------------
Enter option : 1
Enter Username : Admin
Enter Password : Admin@123
-------------------------------
Logged In
-------------------------------
1.Create Acc 2.Update Acc
3.Search Acc 4.Delete Acc
5.Check bal 6.Display Accs
7.Count Accs 8.Main menu
-------------------------------
Enter option : 7
-------------------------------
Total records : 3
-------------------------------
1.Create Acc 2.Update Acc
3.Search Acc 4.Delete Acc
5.Check bal 6.Display Accs
7.Count Accs 8.Main menu
-------------------------------
Enter option : 8
-------------------------------
1.Admin 2.User 3.Exit
-------------------------------
Enter option : 2
-------------------------------
1.Search Acc 2.Check bal
3.Send money 4.Deposit money
5.Main menu
-------------------------------
Enter option : 5
-------------------------------
1.Admin 2.User 3.Exit
-------------------------------
Enter option : 3
-------------------------------
| THANK YOU |
-------------------------------
USER
bruce@Bruce:~/project$ ./bank
-------------------------------
| WELCOME |
-------------------------------
1.Admin 2.User 3.Exit
-------------------------------
Enter option : 2
-------------------------------
1.Search Acc 2.Check bal
3.Send money 4.Deposit money
5.Main menu
-------------------------------
Enter option : 5
-------------------------------
1.Admin 2.User 3.Exit
-------------------------------
Enter option : 3
-------------------------------
| THANK YOU |
-------------------------------