Bms Bank Management System Class 12 Project
Bms Bank Management System Class 12 Project
#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 account::create_account()
cin>>acno;
gets(name);
cin>>type;
type=toupper(type);
cin>>deposit;
cout<<"\n\n\nAccount Created..";
void account::show_account()
cout<<name;
void account::modify()
gets(name);
cin>>type;
type=toupper(type);
cin>>deposit;
void account::dep(int x)
deposit+=x;
void account::draw(int x)
{
deposit-=x;
void account::report()
cout<<acno<<setw(10)<<" "<<name<<setw(10)<<"
"<<type<<setw(6)<<deposit<<endl;
int account::retacno()
return acno;
int account::retdeposit()
return deposit;
char account::rettype()
return type;
}
void write_account(); //function to write record in binary file
int main()
char ch;
int num;
clrscr();
intro();
do
clrscr();
cout<<"\n\n\n\tMAIN MENU";
cout<<"\n\n\t08. 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':
cout<<"\n\n\tEnter The account No. : "; cin>>num;
display_sp(num);
break;
case '5':
display_all();
break;
case '6':
delete_account(num);
break;
case '7':
modify_account(num);
break;
case '8':
break;
default :cout<<"\a";
getch();
}while(ch!='8');
return 0;
}
// function to write in file
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)
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;
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)
return;
outFile.open("Temp.dat",ios::binary);
inFile.seekg(0,ios::beg);
if(ac.retacno()!=n)
{
outFile.write((char *) &ac, sizeof(account));
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;
}
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)
cin>>amt;
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)
// INTRODUCTION FUNCTION
void intro()
cout<<"\n\n\n\t\t\t BANK";
cout<<"\n\n\t\t\t MANAGEMENT";
cout<<"\n\n\t\t\t SYSTEM";
getch();
// END OF PROJECT