Important alert: (current site time 5/21/2013 11:59:59 PM EDT)
 

VB icon

Banking Project

Email
Submitted on: 1/7/2006 8:00:08 PM
By: Raman Goyal 
Level: Advanced
User Rating: By 1 Users
Compatibility: C++ (general), Borland C++
Views: 17698
 
     its a complete banking project which covers all the aspects of banking. it generates the account numbers of users automatically. it has a good gui.

 

INCLUDE files:

Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
//**************************************
//INCLUDE files for :Banking Project
//**************************************
this is a complete banking software.
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.
				
//**************************************
// Name: Banking Project
// Description:its a complete banking project which covers all the aspects of banking.
it generates the account numbers of users automatically. it has a good gui.
// By: Raman Goyal
//
//This code is copyrighted and has// limited warranties.Please see http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=10169&lngWId=3//for details.//**************************************

#include<iostream.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>
#include<stdlib.h>
#include<fstream.h>
#include<iomanip.h>
#include<stdio.h>
#include<string.h>
void box();// functions to draw boxes and lines
void line1();
void style();
void style2(int, char*,char*);
void welcome();
class accnt
{
private:
int acc_no;
char nm[20];
float dep;
float with;
float bal;
int d1,m1,y1;
char type[10];
public:
void get(int x, float y, char z[20])
{
acc_no=x;
bal=y;
strcpy(z,nm);
struct date d;
getdate(&d);
d1=d.da_day;
m1=d.da_mon;
y1=d.da_year;
dep=y;
with=0;
strcpy(type,"INITIAL");
}
 void get2(int x, float y,float dd,float w, char z[20])
 {
acc_no=x;
bal=y;
strcpy(z,nm);
struct date d;
getdate(&d);
d1=d.da_day;
m1=d.da_mon;
y1=d.da_year;
dep=dd;
with=w;
gotoxy(20,20);
cprintf(" BY CASH OR CHEQUE: ");
gotoxy(41,20);
cin>>type;
 }
 void show()
 {
 cout<<setw(4)<<d1<<"/"<<m1<<"/"<<y1<<setw(14)<<type<<setw(17)<<dep<<setw(15)<<with<<setw(18)<<bal<<endl;
 }
 int check(int x)
 {
 if(acc_no==x)
 return 1;
 else
 return 0;
 }
 float checkk(int z)
 {
 if(z==acc_no)
 return (bal);
 else
 return 0;
 }
};
class initial
{
 private:
 int acc;
 char name[20];
 char add[25];
 char nn[20];
 float dep;
 int d2,m2,y2;
 public:
 void get(int x)
 {
 textcolor(LIGHTGREEN);
 struct date d;
 getdate(&d);
 d2=d.da_day;
 m2=d.da_mon;
 y2=d.da_year;
 acc=x;
 gotoxy(20,2);
 cout<<" YOUR ACCOUNT NUMBER IS"<<acc<<endl;
 gotoxy(60,3);
 textcolor(LIGHTGREEN);
 cout<<" date: "<<d2<<"/"<<m2<<"/"<<y2<<endl;
 gotoxy(15,5);
 cout<<" NAME: ";
 gotoxy(15,7);
 cout<<" ADDRESS: ";
 gotoxy(15,9);
 cout<<" NAME OF WITNESS: ";
 gotoxy(15,11);
 cout<<" INITIAL DEPOSIT: ";
 gotoxy(40,5);
 cin>>name;
 gotoxy(40,7);
 cin>>add;
 gotoxy(40,9);
 cin>>nn;
 gotoxy(40,11);
 cin>>dep;
 }
void show()
 {
textcolor(LIGHTGRAY);
 cout<<setw(5)<<acc<<setw(18)<<name<<setw(14)<<add<<setw(18)<<dep<<setw(11)<<d2<<"/"<<m2<<"/"<<y2;
 }
int accno()// function to return account no
{
return(acc);
}
char* ret_name()
{
 return(name);
 }
float balnce()
{
return(dep);
}
char* ret_add()
{
return(add);
}
int match(int x)
{
 if(acc==x)
 return 1;
 else
 return 0;
}
};
void main()
{
accnt b;
initial a;
void graphic();
graphic();
clrscr();
welcome();
clrscr();
fstream file,file1,file2,file3;
char reply;
int flag=1,pos=7,temp=0,var=0,tt=0,tmpacc,ret=0;
float tmp_dep=0,tmp_with=0;
float tmp_bal=0,ch,varr;
char nm[20],aa,ans2,ans;
do
{
AGAIN:
textcolor(LIGHTRED);
clrscr();
gotoxy(26,3);
textbackground(BLACK);
textcolor(LIGHTRED+BLINK);
cprintf(" BANK MANAGEMENT SYSTEM ");
int i;
char c=45;
gotoxy(1,2);
for(i=0;i<78;i++)
cout<<c;
gotoxy(1,4);
for(i=0;i<78;i++)
cout<<c;
gotoxy(30,7);
textcolor(LIGHTRED);
cprintf(" 1: NEW ACCOUNT");
gotoxy(30,9);
cprintf(" 2: SEE ACCOUNT");
gotoxy(30,11);
cprintf(" 3: TRANSACTIONS");
gotoxy(30,13);
cprintf(" 4: ACCOUNTS");
gotoxy(30,15);
cprintf(" 5: DELETE ACCOUNT");
gotoxy(30,17);
cprintf(" 6: EXIT");
gotoxy(30,20);
cprintf(" ENTER YOUR CHOICE: ");
textcolor(LIGHTGRAY);
ans=getche();
switch(ans)
 {
		/* ***************
		for new account
		*************** */
case '1': file.open("init",ios::in|ios::app);
	file.read((char*)&a,sizeof(a));
	file.seekg(0);
	if(file.eof())
	{
	temp=1;
	file.close();
	}
	else
	{
	file.close();
	file.open("init",ios::in);
	file.read((char*)&a,sizeof(a));
	while(!file.eof())
	{
	 temp=a.accno();
	file.read((char*)&a,sizeof(a));
	}
	temp++;
	file.close();
	}
	clrscr();
	textcolor(LIGHTGREEN);
	box();
	a.get(temp);
	gotoxy(15,22);
	cprintf(" SAVE RECORD Y/N");
	cin>>reply;
	if(reply=='y'||reply=='Y')
	{
	file.open("init",ios::app);
	file.write((char*)&a,sizeof(a));
	file.close();
	flag=a.accno();
	tmp_bal=a.balnce();
	strcpy(nm,a.ret_name());
	file1.open("account",ios::app);
	b.get(flag,tmp_bal,nm);
	file1.write((char*)&b,sizeof(b));
	file1.close();
	}
	textcolor(LIGHTGRAY);
	clrscr();
	break;
	/* ***************
	 account list
	 *************** */
case '4': file.open("init",ios::app|ios::in);
	clrscr();
	box();
	line1();
	style();
	pos=7;
	textcolor(LIGHTGRAY);
	file.read((char*)&a,sizeof(a));
	while(!file.eof())
	{
	if(pos==22)
	{
	gotoxy(20,23);
	cprintf(" press any key to continue.....");
	getch();
	clrscr();
	box();
	style();
	pos=7;
	}
	gotoxy(5,pos);
	a.show();
	pos++;
	file.read((char*)&a,sizeof(a));
	}
	pos=7;
	gotoxy(20,23);
	file.close();
	cprintf(" press any key to continue.... ");
	getch();
	clrscr();
	break;
case '3': clrscr();
	ret=0;
	textcolor(LIGHTRED);
	box();
	gotoxy(20,10);
	cprintf("ENTER YOUR ACCOUNT NUMBER ");
	gotoxy(60,10);
	cin>>tmpacc;
	file.open("init",ios::in||ios::app);
	file.read((char*)&a,sizeof(a));
	while(!file.eof())
	 {
		ret=a.match(tmpacc);
		if(ret==1)
		break;
		file.read((char*)&a,sizeof(a));
	 }
	 if(ret!=1)
	 {
	gotoxy(20,15);
	cprintf(" account not found");
	getch();
	textcolor(LIGHTGRAY);
	clrscr();
	file.close();
	goto AGAIN;
	 }
	 if(ret==1)
	 {
	clrscr();
	textcolor(LIGHTCYAN);
	tt=file.tellg();
	file.seekg(tt-5);
	char nm[20];
	char add[25];
	int acc;
	acc=a.accno();
	strcpy(nm,a.ret_name());
	strcpy(add,a.ret_add());
	//style2(acc,nm,add);
	file.close();
	tmp_bal=0;
	file1.open("account",ios::in);
	file1.read((char*)&b,sizeof(b));
	while(!file1.eof())
	{
		ch=b.checkk(tmpacc);
		if(ch!=0)
		tmp_bal=ch;
		file1.read((char*)&b,sizeof(b));
	}
	file1.close();
	box();
	textbackground(BLACK);
	textcolor(LIGHTCYAN+BLINK);
	gotoxy(33,2);
	cprintf("TRANSACTIONS");
	textcolor(LIGHTCYAN);
	gotoxy(20,5);
	cprintf(" NAME: ");
	gotoxy(35,5);
	cout<<nm;
	gotoxy(20,7);
	cprintf(" ADDRRESS: ");
	gotoxy(35,7);
	cout<<add;
	textbackground(BLACK);
	textcolor(LIGHTCYAN+BLINK);
	gotoxy(20,9);
	cprintf(" BALANCE: ");
	char string[25];
	itoa(tmp_bal,string,10);
	gotoxy(31,9);
	cprintf(string);
	textcolor(LIGHTCYAN);
	gotoxy(20,15);
	cprintf(" DEPOSIT(d) OR WITHDRAW(w) ");
	gotoxy(48,15);
	cin>>aa;
	if(aa=='d'||aa=='D')
	{
		gotoxy(20,17);
		//textcolor(LIGHTBLUE);
		cprintf(" ENTER AMOUNT: ");
		gotoxy(36,17);
		cin>>tmp_dep;
		tmp_with=0;
		tmp_bal+=tmp_dep;
		b.get2(acc,tmp_bal,tmp_dep,tmp_with,nm);
		file1.open("account",ios::app);
		file1.write((char*)&b,sizeof(b));
		file1.close();
		textcolor(LIGHTGRAY);
		clrscr();
		break;
	}
	if(aa=='w'||aa=='W')
	{
		gotoxy(20,17);
	//	textcolor(LIGHTBLUE);
		cprintf(" ENTER AMOUNT: ");
		gotoxy(36,17);
		cin>>tmp_with;
		varr=tmp_bal-tmp_with;
		if(varr>4000)
		{
		tmp_dep=0;
		tmp_bal-=tmp_with;
		b.get2(acc,tmp_bal,tmp_dep,tmp_with,nm);
		file1.open("account",ios::app);
		file1.write((char*)&b,sizeof(b));
		file1.close();
		textcolor(LIGHTGRAY);
		clrscr();
		break;
		}
	else
	{
	gotoxy(20,20);
	textbackground(BLACK);
	textcolor(LIGHTCYAN+BLINK);
	cprintf(" SORRY... low balance");
	textcolor(LIGHTBLUE);
	getch();
	clrscr();
	break;
	}
	}
	}
	 getch();
	 clrscr();
	 break;
 case '2': clrscr();
	ret=0;
	textcolor(LIGHTRED);
	box();
	gotoxy(20,10);
	cprintf("ENTER YOUR ACCOUNT NUMBER ");
	gotoxy(60,10);
	cin>>tmpacc;
	file.open("init",ios::in||ios::app);
	file.read((char*)&a,sizeof(a));
	while(!file.eof())
	{
	ret=a.match(tmpacc);
	if(ret==1)
	break;
	file.read((char*)&a,sizeof(a));
	 }
	if(ret!=1)
	{
	gotoxy(20,15);
	cprintf(" account not found");
	getch();
	textcolor(LIGHTGRAY);
	clrscr();
	file.close();
	goto AGAIN;
	}
	if(ret==1)
	{
	clrscr();
	textcolor(LIGHTGRAY);
	box();
	line1();
	tt=file.tellg();
	file.seekg(tt-5);
	char nm[20];
	char add[25];
	int acc;
	acc=a.accno();
	strcpy(nm,a.ret_name());
	strcpy(add,a.ret_add());
	style2(acc,nm,add);
	textcolor(LIGHTGRAY);
	pos=7;
	file.close();
	file1.open("account",ios::in);
	file1.read((char*)&b,sizeof(b));
	while(!file1.eof())
	{
	if(pos==22)
	{
	gotoxy(20,23);
	textcolor(LIGHTGRAY);
	cprintf(" press any key to continue.....");
	getch();
	clrscr();
	box();
	line1();
	style2(acc,nm,add);
	pos=7;
	}
	var=b.check(tmpacc);
	if(var==1)
	{
	gotoxy(2,pos);
	b.show();
	pos++;
	file1.read((char*)&b,sizeof(b));
	}
	if(var==0)
	file1.read((char*)&b,sizeof(b));
	}
	pos=7;
	gotoxy(20,23);
	file1.close();
	cprintf(" press any key to continue.... ");
	getch();
	clrscr();
	}
	break;
 case '5':clrscr();
	ret=0;
	textcolor(LIGHTRED);
	box();
	gotoxy(20,10);
	cprintf("ENTER YOUR ACCOUNT NUMBER ");
	gotoxy(60,10);
	cin>>tmpacc;
	file.open("init",ios::in||ios::app);
	file.read((char*)&a,sizeof(a));
	while(!file.eof())
	{
	ret=a.match(tmpacc);
	if(ret==1)
	break;
	file.read((char*)&a,sizeof(a));
	}
	if(ret!=1)
	{
	gotoxy(20,15);
	file.close();
	cprintf(" account not found");
	getch();
	textcolor(LIGHTGRAY);
	clrscr();
	goto AGAIN;
	}
	if(ret==1)
	{
	clrscr();
	textcolor(LIGHTGREEN);
	box();
	tt=file.tellg();
	file.seekg(tt-5);
	char nm[20];
	char add[25];
	int acc;
	acc=a.accno();
	strcpy(nm,a.ret_name());
	strcpy(add,a.ret_add());
	file.close();
	file1.open("account",ios::in);
	file1.read((char*)&b,sizeof(b));
	while(!file1.eof())
	{
		ch=b.checkk(tmpacc);
		if(ch!=0)
		tmp_bal=ch;
		file1.read((char*)&b,sizeof(b));
	}
	file1.close();
	gotoxy(20,3);
	cprintf(" ACCOUNT NUMBER: ");
	gotoxy(36,3);
	cout<<acc;
	gotoxy(20,7);
	textcolor(LIGHTGREEN);
	cprintf(" NAME: ");
	gotoxy(36,7);
	cout<<nm;
	gotoxy(20,9);
	cprintf(" ADDRRESS: ");
	gotoxy(36,9);
	cout<<add;
	textbackground(BLACK);
	textcolor(LIGHTGREEN+BLINK);
	gotoxy(20,11);
	cprintf(" BALANCE: ");
	char string[45];
	itoa(tmp_bal,string,10);
	gotoxy(36,11);
	cprintf(string);
	textcolor(LIGHTGREEN);
	gotoxy(20,14);
	cprintf(" DELETE ACCOUNT(Y OR N) ");
	gotoxy(45,14);
	cin>>ans2;
	if(ans2=='y'||ans2=='Y')
	{
		file2.open("temp1",ios::out|ios::binary);
		file.open("init",ios::in|ios::binary);
		file.read((char*)&a,sizeof(a));
		while(!file.eof())
		{
		 ret=a.match(tmpacc);
		 if(ret==0)
		 file2.write((char*)&a,sizeof(a));
		 file.read((char*)&a,sizeof(a));
		}
		file.close();
		file2.close();
		file.open("init",ios::out|ios::binary);
		file2.open("temp1",ios::in|ios::binary);
		file2.read((char*)&a,sizeof(a));
		while(!file2.eof())
		 {
		 file.write((char*)&a,sizeof(a));
		 file2.read((char*)&a,sizeof(a));
		 }
		file.close();
		file2.close();
		file3.open("temp2",ios::out|ios::binary);
		file1.open("account",ios::in|ios::binary);
		file1.read((char*)&b,sizeof(b));
		while(!file1.eof())
		{
		 ret=b.check(tmpacc);
		 if(ret==0)
		 file3.write((char*)&b,sizeof(b));
		 file1.read((char*)&b,sizeof(b));
		}
		file1.close();
		file3.close();
		file1.open("account",ios::out|ios::binary);
		file3.open("temp2",ios::in|ios::binary);
		file3.read((char*)&b,sizeof(b));
		while(!file3.eof())
		 {
		 file1.write((char*)&b,sizeof(b));
		 file3.read((char*)&b,sizeof(b));
		 }
		file1.close();
		file3.close();
		}
		}
		clrscr();
		break;
default: clrscr();
	break;
}
}while(ans!='6');
getch();
}
/* ********************************
FUNCTION TO DRAW BOOTING SCREEN
********************************
*/
void graphic()
{
int i,j,k;
char str[25];
 int gd=DETECT,gm;
 initgraph(&gd,&gm," ");
 line(0,20,640,20);
 line(0,20,0,270);//outer border
 line(639,20,639,270);
 line(0,270,639,270);
 for(i=-150;i<700;i=i+3)
 {
 line(i,20,i+150,270);
 }
					 //slant lines
 for(i=26;i<46;i++)
 {
for(int k=6;k<16;k++)
{
gotoxy(i,k);
cout<<" ";
 }
 }
line(280,80,280,240);
line(200,160,360,160);
rectangle(200,80,360,240);//logo
rectangle(230,110,330,210);
rectangle(260,140,300,180);
setfillstyle(SOLID_FILL,4);
floodfill(205,85,15);
floodfill(205,235,15);//filling
floodfill(355,235,15);
floodfill(355,85,15);
setfillstyle(SOLID_FILL,15);
floodfill(235,115,15);
floodfill(235,200,15);
floodfill(325,115,15);
floodfill(325,200,15);
setfillstyle(SOLID_FILL,1);
floodfill(266,146,15);
floodfill(266,175,15);
floodfill(290,146,15);
floodfill(290,175,15);
 rectangle(130,300,431,320);
 setfillstyle(1,4);
 gotoxy(23,25);
 cout<<"LOADING......";
 for(i=131;i<431;i++)
 {
 bar(131,301,i,319);
 j=(i-130)/3;
 gotoxy(35,25);
 cout<<j<<" %";
 if(i>350&&i<400)
 delay(15);
 if(i>400)
 delay(5); //loading
 if(i>320&&i<350)
 delay(80);
 if(i>315&&i<320)
 delay(400);
 if(i<315)
 delay(30);
 }
 outtextxy(150,430,"PRESS ANY KEY TO CONTINUE.....");
 getch();
 closegraph();
 }
/* **************************************************
FUNCTION TO DRAW BOX FOR SEEING ALL ACCOUNT
**************************************************
*/
void line1()
{
 int i;
 char c=196;
 gotoxy(2,6);
 for(i=0;i<78;i++)
 cout<<c;
 gotoxy(2,4);
 for(i=0;i<78;i++)
 cout<<c;
 gotoxy(2,22);
 for(i=0;i<78;i++)
 cout<<c;
}
void box()
{
 int i;
 char c;
 clrscr();
 gotoxy(1,1);
 c=218;
 cout<<c;
 c=196;
 for(i=0;i<79;i++)
 cout<<c;
 c=179;
 gotoxy(1,2);
 for(i=1;i<23;i++)
 cout<<c<<endl;
 c=192;
 cout<<c;
 c=196;
 for(i=0;i<78;i++)
 cout<<c;
 c=217;
 cout<<c;
 gotoxy(80,1);
 c=191;
 cout<<c;
 c=179;
 for(i=2;i<24;i++)
 {
 gotoxy(80,i);
 cout<<c;
 }
}
void style()
{
	 // textbackground(WHITE);
	textcolor(LIGHTGRAY);
	int dd,mm,yy;
	struct date d;
	getdate(&d);
	dd=d.da_day;
	mm=d.da_mon;
	yy=d.da_year;
	gotoxy(70,2);
	cprintf("DATE");
	gotoxy(69,3);
	cout<<dd<<"/"<<mm<<"/"<<yy;
	gotoxy(31,3);
	cprintf("ACCOUNT HOLDERS");
	gotoxy(2,5);
	textbackground(WHITE);
	for(int i=0;i<35;i++)
	cprintf(" ");
	textbackground(BLACK);
	textcolor(BLACK);
	textbackground(WHITE);
	gotoxy(5,5);
	cprintf(" ACCOUNT NONAME ADDRESS DEPOSIT DATE ");
	textbackground(BLACK);
	textcolor(WHITE);
}
void style2(int x, char y[20],char z[25])
{
	int dd,mm,yy;
	struct date d;
	getdate(&d);
	dd=d.da_day;
	mm=d.da_mon;
	yy=d.da_year;
	textcolor(LIGHTGRAY);
	gotoxy(5,2);
	cprintf(" ACCOUNT NUMBER #");
	gotoxy(23,2);
	cout<<x;
	gotoxy(30,2);
	cprintf("NAME: ");
	gotoxy(36,2);
	cout<<y;
	gotoxy(30,3);
	cprintf("ADDRRESS: ");
	gotoxy(40,3);
	cout<<z;
	gotoxy(70,2);
	cprintf("DATE");
	gotoxy(69,3);
	cout<<dd<<"/"<<mm<<"/"<<yy;
	gotoxy(2,5);
	textbackground(WHITE);
	for(int i=0;i<35;i++)
	cprintf(" ");
	textbackground(BLACK);
	textcolor(BLACK);
	textbackground(WHITE);
	gotoxy(5,5);
	cprintf(" DATEPARTICULAR DEPOSIT WITHDRAW BALANCE " );
	textbackground(BLACK);
	textcolor(WHITE);
}
void welcome()
{
 int gd=DETECT,gm;
 initgraph(&gd,&gm," ");
 int i,j,count=0;
 char ch;
 setbkcolor(14);
 setcolor(12);
 settextstyle(7,0,3);
 delay(1200);
 outtextxy(220,50,"W");
 delay(200);
 outtextxy(240,50,"E");
 delay(200);
 outtextxy(260,50,"L");
 delay(200);
 outtextxy(280,50,"C");
 delay(200);
 outtextxy(300,50,"O");
 delay(200);
 outtextxy(316,50,"M");
 delay(200);
 outtextxy(336,50,"E");
 delay(400);
 outtextxy(270,120,"TO");
 delay(500);
 outtextxy(90,190," BANK MANAGEMENT SYSTEM");
 delay(500);
 outtextxy(210,300,"RAMAN GOY");
 outtextxy(348,300,"AL");
 delay(500);
 outtextxy(254,330,"C03547");
 delay(300);
 getch();
 closegraph();
 }


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Advanced category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.