Bank Management C++ Project
Bank Management C++ Project
****************************************************************
#include<iostream.h>
#include<fstream.h>
#include<conio.h>
#include<stdio.h>
#include<iomanip.h>
***************************************************************
class account{
private:
int acno;
char name[50];
int deposit;
char type;
public:
void create_account(); //function to get data from user
cin>>acno;
gets(name);
cin>>type;
type=toupper(type);
cin>>deposit;
cout<<“\n\n\nAccount Created..”;
void account::show_account() {
cout<<“\nAccount No. : “<<acno;}}
void account::modify() {
cout<<“\nThe account No.”<<acno;
gets(name);
cin>>type;
type=toupper(type);
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;
***************************************************************
Function declaration
****************************************************************
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’:
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;
//***************************************************************
void write_account(){
account ac;
ofstream outFile;
outFile.open(“account.txt”,ios::binary|ios::app);
ac.create_account();
outFile.close();
//***************************************************************
int flag=0;
ifstream inFile;
inFile.open(“account.txt”,ios::in|ios::binary);
if(!inFile)
{
return;
cout<<“\nBALANCE DETAILS\n”;
if(ac.retacno()==n)
{
ac.show_account();
flag=1;
inFile.close();
if(flag==0)
cout<<“\n\nAccount number does not exist”;
//***************************************************************
account ac;
fstream File;
File.open(“account.txt”,ios::binary|ios::in|ios::out);
if(!File){
cout<<“File could not be open !! Press any Key…”;
return;
ac.show_account();
ac.modify();
int pos=(-1)*sizeof(account);
File.seekp(pos,ios::cur);
found=1; }
File.close();
if(found==0)
cout<<“\n\n Record Not Found “; }
//***************************************************************
ifstream inFile;
ofstream outFile;
inFile.open(“account.txt”,ios::binary);
if(!inFile) {
cout<<“File could not be open !! Press any Key…”;
return; }
outFile.open(“Temp.txt”,ios::binary);
inFile.seekg(0,ios::beg);
inFile.close();
outFile.close();
remove(“account.txt”);
rename(“Temp.txt”,”account.txt”);
//***************************************************************
void display_all(){
account ac;
ifstream inFile;
inFile.open(“account.txt”,ios::binary);
if(!inFile) {
cout<<“File could not be open !! Press any Key…”;
return; }
cout<<“====================================================\n”;
inFile.close(); }
//***************************************************************
int found=0;
account ac;
fstream File;
File.open(“account.dat”, ios::binary|ios::in|ios::out);
if(!File){
cout<<“File could not be open !! Press any Key…”;
return;
ac.show_account();
if(option==1) {
cout<<“\n\n\tTO DEPOSITE AMOUNT “;
cin>>amt;
ac.dep(amt);
if(option==2) {
cout<<“\n\n\tTO WITHDRAW AMOUNT “;
cout<<“\n\nEnter The amount to be withdraw”;
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
//****************************************************************
void intro(){
cout<<“\n\n\n\t BANK MANAGEMENT SYSTEM “;
//***************************************************************
// END OF PROJECT
//***************************************************************