hey tech guys
Today I am here to explain that how I have make the project of bank management system using c++
In today's world, banking has become an integral part of our lives. We all need to manage our finances and keep track of our accounts. Thanks to the advancements in technology, online banking has made it easier for us to manage our accounts. However, there are still people who prefer to visit a bank and interact with the staff. If you're one of them, then this code might interest you.
This code is a simple console-based application that allows you to perform basic banking operations. It was written in C++ and uses the concepts of classes and objects. The program starts by displaying a menu that gives you the option to open an account, deposit money, withdraw money, display account details, and update your PIN.
Step 1 -->
Here we are importing the necessary header files
#include<conio.h>
--- it is used to interact with console and here we are using getch() function to read the single character without displaying the character
#include<window.h>
--- it is used to for giving colours to text using SetConsoleTextAttribute.
#include<iostream>
--- for cin and cout
step 2--> defining methods
here we are creating a class bank in which we used to define name , address , balance , amount , mobile no and pin as private
and to access these i am creating methods to access it .
In bank management system first column is open account for this
I have created open_account()
function is a method used in a banking system to create a new account for a customer.
To collect the customer's name and address, the function uses the getline()
function from the standard input stream. However, before calling the getline()
function, the cin.ignore()
function is called to discard any extraneous newline characters that may have been left in the input stream after a previous input operation. This ensures that the getline()
function will only read the customer's input and not any leftover newline characters.
after that customer mobile number and pin is taken as input then it asks whether you are opening saving or current account.
after gathering all information your new account has been created.
To customize the text in colourful to look attractive i have used SetConsoleTextAttribute
.
The display_account()
function is used to display the account details of a customer. It uses the cout
statement to display various details like the customer's name, address, mobile number, account type, and balance. These details are stored in variables like name
, add
, mobile_no
, y
, and balance
. The SetConsoleTextAttribute()
function is used to set the color of the console output to make it more visually appealing.
The set_pin()
function is used to set a 4-digit PIN for the customer's account. It uses the cout
statement to prompt the customer to enter a PIN, and then uses the cin
statement to read in the input. Once the PIN is entered, a confirmation message is displayed using the cout
statement.
and your pin has been set successfully.
The function update_pin()
is used to update the PIN for a specific account. It first prompts the user to enter their old PIN, and if the entered PIN does not match the current PIN, the function returns with an error message (invalid pin)
. Otherwise, the function prompts the user to enter a new 4-digit PIN, which is then assigned to the pin
variable. Finally, the function displays a success message indicating that the PIN has been updated successfully. To compare whether the entered pin is write or wrong I have used if statement and if the pin is write then you are able to change the pin and your pin will be updated successfully.
step 3-->
As we all know that firstly the main function executes .
through the above code I have made the front page of my cpp bank management system . To make first output attractive I have uses different colours of text using SetConsoleTextAttribute
with different colour code for example 3 is for navy blue.
The switch statement is used to execute different blocks of code depending on the value of a given variable or expression.
In this case, the variable being evaluated is "ch", and based on its value, different functions of the object "obj" are being called.
For example, if ch=1, the function "open_account" is called, if ch=2, the function "deposite_money" is called, and so on.
If ch=5, the code will print "Exit" and if ch=6, the function "update_pin" is called.
In the end, if none of the cases match, the default case is executed and a message saying "Invalid option! Please try again." is displayed.
The function starts by setting the console text color to the default color using the SetConsoleTextAttribute()
function. Then, a do-while
loop is used to repeat the program until the user chooses to terminate.
Then backbone of a banking program came that lets users perform various banking operations. Users are prompted to choose their next step and can choose to continue or terminate the program. The program uses the getch() function to read the user's input without displaying it on the screen. If the user chooses to terminate, the program exits, and if they choose to continue, they are presented with the options again. This program provides a user-friendly and efficient way for users to manage their accounts.
some outputs through which you guys could understand
for opening account press
1
in the above output write necessary details like name, address, set pin also clarify whether u are opening saving account or current . After that specify the amount that you want to deposit . Now if you want to continue to use the bank services then press y or Y and if you want to terminate this then press n or N.
here i have press y
In the above code i want to see my bank account that how much amount my account has. after that i want to continue the services so I have pressed Y.
now i want to withdraw the money from my bank account which require pin but i have given wrong pin thats why my transaction fails with the error message of invalid pin
.
now I have given right pin and I am able to withdraw the amount of 5000 and remaining balance has been displayed in the promt.
after that I have pressed y and this time i want to change my pin.
In above i have pressed 5 to update my pin for this i have to write my old pin if it is right then i am able to change my pin otherwise not . After my pin changed for maintaining security I would like to exit or terminate it so I have to press n.
press two times n then you even exited from the promt .
This is a simple bank management system I have made using c++ it maintain the record until your program is running otherwise your record will be deleted .
if you want to maintain the record after booting also you have to use filehandeling where the details of account is being saved even after termination of program.
To connect with me:- My linked in profile