BANKING SYSTEM PROJECT
Description: This C++ programs on BANKING SYSTEM has account class with data members like account number,name,deposit, withdraw amount and type of account. Customer data is stored in a binary file. A customer can deposite and withdraw amount in his account. User can create, modify and delete account.
SOURCE CODE - BANK MANAGEMENT SYSTEM
Select this program and save as .cpp file and compile it on C++.
//*************************************************************** // HEADER FILE USED IN PROJECT //**************************************************************** #include<fstream.h> #include<conio.h> #include<stdio.h> #include<process.h> #include<ctype.h> //*************************************************************** // CLASS USED IN PROJECT //**************************************************************** class account { int acno, deposit, withdraw; char name[50]; char type; public: void create_account() { cout<<"\n\n====NEW ACCOUNT ENTRY FORM====\n\n"; cout<<"\nEnter The account Number : "; cin>>acno; cout<<"\nEnter The Name of The account Holder : "; gets(name); cout<<"\nEnter Type of The account (C/S) : "; cin>>type; type=toupper(type) cout<<"\nEnter Initial amount\n>=500 for Saving >=1000 for current :"; cin>>deposit; cout<<"\n\n\nYour Account Created Successfully .."; } void show_account() { cout<<"\n\n----ACCOUNT STATUS----\n"; cout<<"\nAccount No. : "<<acno; cout<<"\nAccount Holder Name : "<<name; cout<<"\nType of Account : "<<type; cout<<"\nBalance amount : "<<deposit; } void modify_account() { cout<<"\nAccount No. : "<<acno; cout<<"\nModify Account Holder Name : "; gets(name); cout<<"Modify Type of Account : ";cin>>type; cout<<"Modify Balance amount : ";cin>>deposit; } void dep(int x) { deposit+=x; } void draw(int x) { deposit-=x; } void report() { cout<<acno<<"\t"<<name<<"\t\t"<<type<<"\t\t"<<deposit<<endl; } int retacno() { return acno; } float retdeposit() { return deposit; } char rettype() { return type; } }; //class ends here //*************************************************************** // global declaration for stream object, object //**************************************************************** fstream fp; account ac; //*************************************************************** // function to write in file //**************************************************************** void write_account() { fp.open("account.dat",ios::out|ios::app); ac.create_account(); fp.write((char*)&ac,sizeof(account)); fp.close(); } //*************************************************************** // function to read specific record from file //**************************************************************** void display_sp() { int n; cout<<"\n\n====BALANCE DETAILS===="; cout<<"\n\nEnter the Account Number : "; cin>>n; int flag=0; fp.open("account.dat",ios::in); while(fp.read((char*)&ac,sizeof(account))) { if(ac.retacno()==n) { ac.show_account(); flag=1; } } fp.close(); if(flag==0) cout<<"\n\nAccount Number does not exist"; getch(); } //*************************************************************** // function to modify record of file //**************************************************************** void modify_account() { int no,found=0; cout<<"\n\n====MODIFY RECORD===="; cout<<"\n\nEnter the Account No. : "; cin>>no; fp.open("account.dat",ios::in|ios::out); while(fp.read((char*)&ac,sizeof(account)) && found==0) { if(ac.retacno()==no) { ac.show_account(); cout<<"\n\n\n----Enter the New Details----\n"; ac.modify_account(); int pos=-1*sizeof(ac); fp.seekp(pos,ios::cur); fp.write((char*)&ac,sizeof(account)); cout<<"\n\n\t Record Updated"; found=1; } } fp.close(); if(found==0) cout<<"\n\n Record Not Found "; getch(); } //*************************************************************** // function to delete record of file //**************************************************************** void delete_account() { int no; cout<<"\n\n====Delete Record===="; cout<<"\n\nEnter The Account No. : "; cin>>no; fp.open("account.dat",ios::in|ios::out); fstream fp2; fp2.open("Temp.dat",ios::out); fp.seekg(0,ios::beg); while(fp.read((char*)&ac,sizeof(account))) { if(ac.retacno()!=no) { fp2.write((char*)&ac,sizeof(account)); } } fp2.close(); fp.close(); remove("account.dat"); rename("Temp.dat","account.dat"); cout<<"\n\n\tRecord Deleted .."; getch(); } //*************************************************************** // function to display all accounts deposit list //**************************************************************** void display_all() { fp.open("account.dat",ios::in); if(!fp) { cout<<"ERROR!!! FILE COULD NOT BE OPEN "; getch(); return; } cout<<"\n\n\t\tACCOUNT HOLDER LIST\n\n"; cout<<"====================================================\n"; cout<<"A/c no.\tNAME\t\tType\t\tBalance\n"; cout<<"====================================================\n"; while(fp.read((char*)&ac,sizeof(account))) { ac.report(); } fp.close(); getch(); } //*************************************************************** // function to deposit and withdraw amounts //**************************************************************** void deposit_withdraw(int option) { int no,found=0,amt; cout<<"\n\n====ACCOUNT TRANSCATION FORM===="; cout<<"\n\nEnter The account No. : "; cin>>no; fp.open("account.dat",ios::in|ios::out); while(fp.read((char*)&ac,sizeof(account)) && found==0) { if(ac.retacno()==no) { ac.show_account(); if(option==1) { cout<<"\n\nEnter The amount to DEPOSIT : "; cin>>amt; ac.dep(amt); } if(option==2) { cout<<"\n\nEnter The amount to WITHDRAW : "; cin>>amt; int bal=ac.retdeposit()-amt; if((bal<500 && ac.rettype()=='S') || (bal<1000 && ac.rettype()=='C')) cout<<"\nInsufficience balance"; else ac.draw(amt); } int pos=-1*sizeof(ac); fp.seekp(pos,ios::cur); fp.write((char*)&ac,sizeof(account)); cout<<"\n\n\t Record Updated"; found=1; } } fp.close(); if(found==0) cout<<"\n\n Record Not Found "; getch(); } //*************************************************************** // INTRODUCTION FUNCTION //**************************************************************** void intro() { clrscr(); gotoxy(5,7); cout<<"=============================="; gotoxy(18,11); cout<<"BANK"; gotoxy(15,14); cout<<"MANAGEMENT"; gotoxy(17,17); cout<<"SYSTEM"; gotoxy(5,21); cout<<"=============================="; gotoxy(5,24); cout<<"MADE BY : Aniket Rajput"; gotoxy(5,26); cout<<"SCHOOL : St. Thomas School"; getch(); } //*************************************************************** // THE MAIN FUNCTION OF PROGRAM //**************************************************************** void main() { char ch; intro(); do { clrscr(); cout<<"\n\n\n\tMAIN MENU"; cout<<"\n\n\t01. NEW ACCOUNT"; cout<<"\n\n\t02. DEPOSIT AMOUNT"; cout<<"\n\n\t03. WITHDRAW AMOUNT"; cout<<"\n\n\t04. BALANCE ENQUIRY"; cout<<"\n\n\t05. ALL ACCOUNT HOLDER LIST"; cout<<"\n\n\t06. CLOSE AN ACCOUNT"; cout<<"\n\n\t07. MODIFY AN ACCOUNT"; cout<<"\n\n\t08. EXIT"; cout<<"\n\n\tSelect Your Option (1-8) "; ch=getche(); clrscr(); switch(ch) { case '1': write_account(); getch(); break; case '2': deposit_withdraw(1); break; case '3': deposit_withdraw(2); break; case '4': display_sp(); break; case '5': display_all(); break; case '6': delete_account(); break; case '7': modify_account(); break; case '8': exit(0); default : cout<<"\a"; } }while(ch!='8'); } //*************************************************************** // END OF PROJECT //***************************************************************
thank u very much
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThese mahatos have no respect for human beans
Deleteonly real human beans allowed 0/10
it can accomodate the accounts having same acc no
ReplyDeleteHow about using include: iomanip, iostream, string,& using namespace std Only in a bank system project ,is that possible?
ReplyDeletecan anyone show me how to change pin and create new account through functions?
ReplyDelete