Académique Documents
Professionnel Documents
Culture Documents
Name – Om Jaiswal
Class – XII
AISSCE Roll number –
i
Computer Science Project(083)
Project name – Bank Management System
ii
Certificate
____________________ ________________
Swarup Kumar Maity Lopa Chatterjee
Computer Science Teacher Principal
____________________
External Examiner
iii
Acknowledgement
iv
Contents
Cover page i
Title ii
Certificate iii
Acknowledgement iv
Contents v
Introduction 1
Program logic 2
Program code 4
Output 17
Variable description 26
Function description 26
Object description 27
Class description 28
Utility of the project 29
Bibliography 30
v
Introduction
The Bank Management System is a completely C++ oriented
database system. The actual transactions being held in a bank,
has been transformed into a completely digitized form.
Without the use of any graphics, the program is command
driven one where the user needs to read the commands and
operate the transactions.
The Bank Management System provides the user with couple
of account options. As per user’s choice, the user is allowed to
deposit or withdraw money from the bank. All these
transactions can be made at any point of time, as and when
required.
This is just a basic database system for a bank offering the
basic transaction facilities. Being the dummy of any realistic
bank system, it serves the purpose of handling a bank at the
grass root level.
1
Program Logic
The program declares a class account with 4 private data
members to store the details of an account and 9 member
functions(outline). The function create_account() gets the data
from the user and show_account() displays all those details.
The function modify() accepts the new details for an account
from the user. Functions dep(int) and draw(int) accept the
amount to be deposited or withdrawn respectively. The
function report() displays the list of all the account holder
along with their account details in a tabular format. Functions
retacno(),retdeposit() and retype() are accessors which return
account number, balance amount and type of account
respectively.
Besides these member functions there are also 7 other public
functions to carry out all the above mentioned operations on a
datafile which keeps track of all the records and details
pertaining to each account holder. The function
write_account() writes a record to the binary file while the
function display_sp(int) reads a record from the binary file and
displays it. Functions modify_account(int) and
delete_account(int) modify and delete records from the file
respectively.The function deposit_withdraw(int,int) updates
the balance amount in the file as per user’s requirements.
There is also an introductory function intro() which display the
details of the developers on the screen.
2
The main() function execute intro() first and then displays a
menu and calls the respective functions as and when required
as per the user’s choice. It drives the control of the entire
program until termination.
3
Program Code
//****************************************************************
//****************************************************************
#include<fstream.h>
#include<ctype.h>
#include<iomanip.h>
#include<conio.h>
#include<stdio.h>
//****************************************************************
//****************************************************************
class account
int acno;
char name[50];
int deposit;
char type;
public:
void draw(int); //function to accept amount and subtract from balance amount
void account::create_account()
cin>>acno;
gets(name);
cin>>type;
type=toupper(type);
cout<<"Enter initial amount(>=500 for Savings and >=1000 for Current) : ";
cin>>deposit;
cout<<"\n\nAccount created!";
void account::show_account()
cout<<name;
void account::modify()
gets(name);
type=toupper(type);
cin>>deposit;
deposit+=amt;
deposit-=amt;
void account::report()
int account::retacno()
return acno;
int account::retdeposit()
return deposit;
6
}
char account::rettype()
return type;
//****************************************************************
// FUNCTION DECLARATION
//****************************************************************
//****************************************************************
//****************************************************************
int main()
char ch;
int num;
clrscr();
intro();
do
clrscr();
cout<<"\n\n\t8. EXIT";
cin>>ch;
clrscr();
switch(ch)
case '1':
write_account();
break;
case '2':
deposit_withdraw(num, 1);
break;
case '3':
deposit_withdraw(num, 2);
break;
case '4':
display_sp(num);
break;
case '5':
8
display_all();
break;
case '6':
modify_account(num);
break;
case '7':
delete_account(num);
break;
case '8':
break;
default :
getch();
}while(ch!='8');
return 0;
//****************************************************************
//****************************************************************
void write_account()
account ac;
ofstream outFile;
outFile.open("account.dat",ios::binary|ios::app);
9
ac.create_account();
outFile.close();
//****************************************************************
//****************************************************************
account ac;
int found=0;
ifstream inFile;
inFile.open("account.dat",ios::binary);
if(!inFile)
return;
if(ac.retacno()==num)
ac.show_account();
found=1;
inFile.close();
if(found==0)
//****************************************************************
//****************************************************************
int found=0;
account ac;
fstream File;
File.open("account.dat",ios::binary|ios::in|ios::out);
if(!File)
return;
if(ac.retacno()==num)
ac.show_account();
ac.modify();
int pos=(-1)*sizeof(account);
File.seekp(pos,ios::cur);
found=1;
}
11
File.close();
if(found==0)
//****************************************************************
//****************************************************************
int found==1;
account ac;
ifstream inFile;
ofstream outFile;
inFile.open("account.dat",ios::binary);
if(!inFile)
return;
outFile.open("Temp.dat",ios::binary);
inFile.seekg(0,ios::beg);
if(ac.retacno()!=num)
else
found==0;
12
}
inFile.close();
outFile.close();
remove("account.dat");
rename("Temp.dat","account.dat");
if(found==0)
cout<<"\n\n\tAccount closed.";
else
//****************************************************************
//****************************************************************
void display_all()
account ac;
ifstream inFile;
inFile.open("account.dat",ios::binary);
if(!inFile)
return;
cout<<"====================================================\n";
cout<<"====================================================\n";
{
13
ac.report();
inFile.close();
//****************************************************************
//****************************************************************
int amt;
int found=0;
account ac;
fstream File;
File.open("account.dat", ios::binary|ios::in|ios::out);
if(!File)
return;
if(ac.retacno()==num)
ac.show_account();
if(option==1)
cin>>amt;
14
ac.dep(amt);
if(option==2)
cin>>amt;
int bal=ac.retdeposit()-amt;
cout<<"Insufficient balance...";
else
ac.draw(amt);
File.seekp(pos,ios::cur);
found=1;
File.close();
if(found==0)
//****************************************************************
// INTRODUCTORY FUNCTION
//****************************************************************
void intro()
{
15
cout<<"\n\n\n\n\n\n\t\t\t\t BANK";
cout<<"\n\n\t\t\t\t MANAGEMENT";
cout<<"\n\n\t\t\t\t SYSTEM";
getch();
//***************************************************************
// END OF PROJECT
//***************************************************************
16
Output
17
18
19
20
21
22
23
24
25
Variable Description
Variable Data
Purpose
Name Type
acno,num int To store account number of an account
name char To store name of account holder
deposit int To store initial balance amount
type char To store the type o account
To store amount to be deposited or
amt int
withdrawn
To store user’s choice for the menu
ch char
displayed
found int Flag variable
Formal parameter to store choice for
option int
either deposition or withdrawal
pos int File pointer
Function Description
Function Return
Description
Name Type
To get details of an account
create_account() void
from the user
To display the details of
show_account() void
account
To get new details for an
modify() void
account from the user
To deposit cash into an
dep(int) void
account
To withdraw cash from an
draw(int) void
account
To display details of all
report() void
account holders
retacno() int To return account number
To return balance amount
retdeposit() int
of an account
retype() char To return account type(C/S)
To add records into a
write_account() void
binary file
To read account details
display_sp(int) void
from file
To modify records in the
modify_account(int) void
datafile
To delete a record from the
delete_account(int) void
file
To display details of all
display_all() void
account holders
To deposit or withdraw
deposit_withdraw(int,int) void cash from an account as per
command
To display details about the
intro() void
developers
Object Description
Object
Type Description
Name
The object invoking all member functions of
ac account
class account
Object to add records into a binary file
outFile ofstream
account.dat
Object to read records from the same binary
inFile ifstream
file
File fstream Object to modify records in the datafile
27
Class Description
Class name Description
A class containing data members and member
account functions to carry out all the operations
pertaining to a bank management system
28
Utility of the Project
29
Bibliography
30