Topic:: Banking Management
Topic:: Banking Management
Pritam Das
Class - XII A
{AS PER CBSE GUIDELINES}
(PGT-CSE)
Acknowledgement
We would like to thank Mr. Rohit Chaudhry (Computer Science Lecturer),
for his able guidance and the support exhibited by him in the completion
of the project.
Thanking you
Pritam Das
Principle signature
2
CERTIFICATE
This is to certify that Pritam Das of class XII ‘A’ have
successfully completed their Computer Project on ‘Banking Management’
under the able guidance of Mr. Rohit Chaudhry
Examiner Principal Mr. Rohit Chaudhry
(Computer Science Lecturer)
3
Declaration
I hereby declare that the project work entitled “Banking management”,
submitted to Department of Computer science, Homerton Grammar School, is
prepared by me. All the coding are result of my personal effort.
Pritam Das
Class XII A
4
Index
Acknowledgement……………………………..2
Certificate……………………………………..3
Declaration…………………………………….4
Header file……………………………………..6
Banking………………………………………...7
Coding…………………………………………8
Output screen………………………………….21
Bibliography…………………………………...27
5
Header files
#include<fstream.h>
#include<ctype.h>
#include<iomanip.h>
#include<conio.h>
#include<stdio.h>
#include<process.h>
6
Program Source Code *
/*
* ----------------------------------------------------------------------------
File:banking.CPP
* ----------------------------------------------------------------------------
*/
//***************************************************************
//****************************************************************
#include<fstream.h>
#include<ctype.h>
#include<iomanip.h>
#include<conio.h>
#include<stdio.h>
#include<process.h>
//***************************************************************
//****************************************************************
class account
int acno;
char name[50];
int deposit;
char type;
public:
8
void create_account(); //function to get data from user
void draw(int); //function to accept amount and subtract from balance amount
account()
acno=deposit=0;
void account::create_account()
cin>>acno;
gets(name);
cin>>type;
type=toupper(type);
cout<<"\nEnter The Initial amount(>=500 for Saving and >=1000 for current ) : ";
cin>>deposit;
cout<<"\n\n\nAccount Created..";
void account::show_account()
9
int account::retacno()
{
return acno;
}
int account::retdeposit()
{
return deposit;
}
char account::rettype()
{
return type;
}
//***************************************************************
// function declaration
//****************************************************************
void write_account(); //function to write record in binary file
void display_sp(int); //function to display account details given by user
void modify_account(int); //function to modify record of file
void delete_account(int); //function to delete record of file
void display_all(); //function to display all account details
void deposit_withdraw(int, int); // function to desposit/withdraw amount for given account
void intro(); //introductory screen function
void invalid();
//***************************************************************
// THE MAIN FUNCTION OF PROGRAM
//****************************************************************
11
int main()
char ch;
int num;
clrscr();
intro();
do
clrscr();
cout<<"\n\n\n\tMAIN MENU";
cout<<"\n\n\t08. EXIT";
cin>>ch;
clrscr();
if(ch<64||ch>123)
switch(ch)
case '1':
write_account();
break;
case '2':
deposit_withdraw(num, 1);
break;
12
case '3':
cout<<"\n\n\tEnter The account No. : "; cin>>num;
deposit_withdraw(num, 2);
break;
case '4':
cout<<"\n\n\tEnter The account No. : "; cin>>num;
display_sp(num);
break;
case '5':
display_all();
break;
case '6':
cout<<"\n\n\tEnter The account No. : "; cin>>num;
delete_account(num);
break;
case '7':
cout<<"\n\n\tEnter The account No. : "; cin>>num;
modify_account(num);
break;
case '8':
cout<<"\n\n\tThanks for using bank managemnt system.";
break;
default :cout<<"\a";
invalid();
break;
}
}
else
{
cout<<"Characters Not allowed"<<endl;
cout<<"Inspite of WARNING you entered alphabets.... \n\n Program will Exit now.. ";
getch();
exit(0);
13
}
getch();
}while(ch!='8');
return 0;
//***************************************************************
//****************************************************************
void write_account()
account ac;
ofstream outFile;
outFile.open("account.dat",ios::binary|ios::app);
ac.create_account();
outFile.close();
//***************************************************************
//****************************************************************
void display_sp(int n)
account ac;
int flag=0;
ifstream inFile;
inFile.open("account.dat",ios::binary);
if(!inFile)
14
cout<<"File could not be open !! Press any Key...";
return;
cout<<"\nBALANCE DETAILS\n";
if(ac.retacno()==n)
ac.show_account();
flag=1;
inFile.close();
if(flag==0)
//***************************************************************
//****************************************************************
void modify_account(int n)
int found=0;
account ac;
fstream File;
File.open("account.dat",ios::binary|ios::in|ios::out);
if(!File)
return;
15
while(File.read((char *) &ac, sizeof(account)) && found==0)
if(ac.retacno()==n)
ac.show_account();
ac.modify();
int pos=(-1)*sizeof(account);
File.seekp(pos,ios::cur);
found=1;
File.close();
if(found==0)
//***************************************************************
//****************************************************************
void delete_account(int n)
account ac;
ifstream inFile;
ofstream outFile;
inFile.open("account.dat",ios::binary);
if(!inFile)
16
return;
outFile.open("Temp.dat",ios::binary);
inFile.seekg(0,ios::beg);
if(ac.retacno()!=n)
inFile.close();
outFile.close();
remove("account.dat");
rename("Temp.dat","account.dat");
//***************************************************************
//****************************************************************
void display_all()
account ac;
ifstream inFile;
inFile.open("account.dat",ios::binary);
if(!inFile)
return;
17
cout<<"====================================================\n";
cout<<"====================================================\n";
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()==n)
ac.show_account();
if(option==1)
18
cout<<"\n\n\tTO DEPOSITE AMOUNT ";
cin>>amt;
ac.dep(amt);
if(option==2)
cin>>amt;
int bal=ac.retdeposit()-amt;
cout<<"Insufficience balance";
else
ac.draw(amt);
File.seekp(pos,ios::cur);
found=1;
File.close();
if(found==0)
//***************************************************************
// INTRODUCTION FUNCTION
//****************************************************************
19
void intro()
cout<<"\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();
void invalid()
20
Output
. INTRODUCTION
. MAIN MENU
21
. NEW ACCOUNT
.DEPOSIT AMOUNT
22
.WITHDRAW AMOUNT
. BALANCE ENQUIRY
23
. ALL ACCOUNT HOLDER LIST
. CLOSE AN ACCOUNT
24
. MODIFY AN ACCOUNT
. EXIT
25
BIBLIOGRAPHY
26