Anda di halaman 1dari 16

//*********************************************************/

/ BANKING PROJECT
//********************************************************
#include<iostream.h>
#include<string.h>
#include<graphics.h>
#include<fcntl.h>
#include<process.h>
#include<stdio.h>
#include<fstream.h>
#include<iomanip.h>
#include<conio.h>
#include<dos.h>
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
// DELCARE THE STRUCTURE OF THE PROGRAM
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
struct bank
{
char name[35];
float amount;
long int account_number;
char father_name[35];
long int phone_number;
int customer_number;
char address[40];

};
bank b1;
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// PROTYPE OF FUNCTION OF THE PROGRAM
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
void get_data();
void delete_account();
void transcation();
void introduction();
void deposit();
void report();
void search();
void withdraw();
void menu();
void welcome();
void show_data();
void add_object();
void modify();
void box(int,int,int,int);
int balance=0;
fstream file;
//|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// INTRODUCTION FUNCTION OF THE PROGRAM
//|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
void introduction()
{
clrscr();
box(4,4,75,45);
gotoxy(12,7);
textcolor(YELLOW);
textbackground(BLACK);
cprintf("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$");
gotoxy(21,9);
textcolor(RED);
textbackground(BLACK);
cprintf("::::: BANKING PROJECT :::: ");
gotoxy(12,11);
textcolor(YELLOW);
cprintf("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$");
gotoxy(25,15);
textcolor(RED);
cprintf(" INTRODUCTION ");
gotoxy(10,18);
textcolor(WHITE);
cprintf(" Our Project based upon banking accounts.
This Project has \n");
gotoxy(10,20);
cout<<" been facility to maintain the record of
accounts.Following ";
gotoxy(10,22);
cout<<" are the Functions :- ";
gotoxy(10,25);
cout<<" In first option you can Open a New
Account ";
gotoxy(10,27);
cout<<" In second option you can Closed a
Account ";
gotoxy(10,29);
cout<<" Through Third option you can Deposit a
amount in the Account";
gotoxy(10,31);
cout<<" Through Fourth option you can Withdraw a
amount in the Account";
gotoxy(10,33);
cout<<" By using fifth option you can Modify any
Account ";
gotoxy(10,35);
cout<<" In sixth option you can see list of all
the Acccouts ";
gotoxy(10,37);
cout<<" In this option you can Search any Account
";
gotoxy(10,39);
cout<<" Exit option is used to Quit from the
Project ";
gotoxy(27,43);
textcolor(RED);
cprintf(" Press any key to continue.....");
getch();
}

//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&
// WELCOME FUNCTION TO DISPLAY
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&
void welcome()
{
clrscr();
gotoxy(27,24);
textcolor(YELLOW+BLINK);
textbackground(BLACK);
cprintf(" WELCOME ");
gotoxy(34,27);
textcolor(RED);
cprintf(" HDFC BANK " );
}
//##########################################################
#######
// BOX FUNCTION OF THE PROGRAM
//##########################################################
#######
void box(int x1,int y1,int x2,int y2)
{
for(int col=x1;col<x2;col++)
{
gotoxy(col,y1);
cprintf("%c",'$');
gotoxy(col,y2);
textcolor(LIGHTCYAN);
cprintf("%c",'$');
}
for(int row=y1;row<y2;row++)
{
gotoxy(x1,row);
cprintf("%c",'$');
gotoxy(x2,row);
cprintf("%c",'$');
}
gotoxy(x1,y1);
cprintf("%c",218);
gotoxy(x1,y2);
cprintf("%c",192);
gotoxy(x2,y1);
cprintf("%c",191);
gotoxy(x2,y2);
cprintf("%c",217);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%
// STORE A RECORD IN STUDIO.TXT FILE OF PROGRAM
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%
void add_object()
{
char c1='y';
while(c1=='y' || c1=='Y')
{
file.open("bank.txt",ios::app);
get_data();
file.write((char*)&b1,sizeof(b1));
file.flush();
file.close();
gotoxy(22,35);
cout<<"want to add more record(y/n)......";
cin>>c1;
}
if(c1=='n' ||c1=='N')
{
menu();
}
}

//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
<<<<<<<
// DISPLAY FUNCTION OF THE PROGRAM
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
<<<<<<<
void show_data()
{
clrscr();
box(10,2,67,40);
textcolor(RED);
gotoxy(20,5);

cprintf("============================================");
gotoxy(23,7);
textbackground(BLACK);
textcolor(RED+BLINK);
cprintf(" ::::: RECORD MENU :::::: ");
gotoxy(20,9);
textcolor(RED);

cprintf("============================================");
gotoxy(25,12);
cout<<" ACCOUNT NUMBER : "
<<b1.account_number;
gotoxy(25,15);
cout<<" CUSTOMER NAME : " <<b1.name;
gotoxy(25,18);
cout<<" CUSTOMER'S FATHER NAME : "
<<b1.father_name;
gotoxy(25,21);
cout<<" ADDRESS : "
<<b1.address;
gotoxy(25,24);
cout<<" PHONE NUMBER : "
<<b1.phone_number;
gotoxy(25,27);
cout<<" ENTER THE AMOUNT : "
<<b1.amount;
getch();

}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@
// ADD NEW ACCOUNT FUNCTION FOR ENTERING
RECORD
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@
void get_data()
{
clrscr();
box(10,2,77,40);
gotoxy(20,5);
textbackground(BLACK);
textcolor(WHITE);

cprintf(":::::::::::::::::::::::::::::::::::::::::::::::::::
");
gotoxy(30,7);
textcolor(WHITE+BLINK);
cprintf(" OPEN A NEW ACCOUNT ");
gotoxy(20,9);
textcolor(WHITE);

cprintf(":::::::::::::::::::::::::::::::::::::::::::::::::::
");
gotoxy(19,12);
cout<<" ENTER THE ACCOUNT NUMBER ";
cin>>b1.account_number;
gotoxy(19,15);
cout<<" ENTER THE CUSTOMER NAME ";
cin>>b1.name;
gotoxy(19,18);
cout<<" ENTER THE CUSTOMER'S FATHER NAME ";
cin>>b1.father_name;
gotoxy(19,21);
cout<<" ENTER THE ADDRESS ";
cin>>b1.address;
gotoxy(19,24);
cout<<" ENTER THE PHONE NUMBER ";
cin>>b1.phone_number;
gotoxy(19,27);
cout<<" ENTER THE AMOUNT ";
cin>>b1.amount;

}
//----------------------------------------------------------
------
// DELETE RECORD OF THE PROGRAM
//----------------------------------------------------------
------
void delete_account()
{
int account_number;
fstream file1,file2;
clrscr();
file1.open("bank.txt",ios::in);
file2.open("temp.txt",ios::app);
box(10,3,70,40);
gotoxy(15,5);
cout<<"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$$$";
gotoxy(29,7);
cout<<" CLOSE THE ACCOUNT ";
gotoxy(15,9);
cout<<"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$$$";
gotoxy(22,12);
cout<<"Enter The Account Number ";
cin>>account_number;
while(!file1.eof())
{
if(account_number!=
b1.account_number)
file2.write((char*)&b1,sizeof(b1));
else
{
show_data();

}
file2.flush();

file1.read((char*)&b1,sizeof(b1));
}
gotoxy(25,30);
cout<<" Want To Close The Account
y/n......\n";
gotoxy(55,33);
char ans;
cin>>ans;
if(ans=='n'|| ans=='N')
{
return;
}
file1.close();
file2.close();
remove("bank.txt");
rename("temp.txt","bank.txt");
gotoxy(25,36);
cout<<" Your Account Has Been Closed.....";
getch();
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++
// DEPOSIT FUNCTION OF THE PROGRAM
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++
void deposit()
{
long int account_number;
int balance;
fstream file1,file2;
clrscr();
file1.open("bank.txt",ios::in);
file2.open("temp.txt",ios::app);
box(10,3,70,40);
gotoxy(19,5);
textbackground(BLACK);
textcolor(RED);

cprintf("************************************************");
gotoxy(25,7);
cout<<" FOR DEPOSIT AMOUNT ";
gotoxy(19,9);

cout<<"************************************************";
gotoxy(21,12);
cout<<" Enter The Account Number ";
cin>>account_number;
file1.seekg(0,ios::beg);
file1.read((char*)&b1,sizeof(b1));
while(!file1.eof())
{
if(account_number !=b1.account_number)
{
file2.write((char*)&b1,sizeof(b1));
}
else
{
show_data();
getch();
int dep=0;
gotoxy(21,30);
cout<<" Enter Deposit Amount= ";
cin>>dep;
balance=b1.amount;
balance=balance+dep;
gotoxy(21,33);
cout<<" Current Balance= "
<<balance;
b1.amount=balance;
file2.write((char*)&b1,sizeof(b1));
getch();
}
file2.flush();
file1.read((char*)&b1,sizeof(b1));

}
file1.close();
file2.close();
remove("bank.txt");
rename("temp.txt","bank.txt");
getch();
}
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::
// WITHDRAWAL FUNCTION OF THE PROGRAM
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::
void withdraw()
{
long int account_number;
int balance;
fstream file1,file2;
clrscr();
file1.open("bank.txt",ios::in);
file2.open("temp.txt",ios::app);
box(10,3,70,40);
gotoxy(19,5);
textbackground(BLACK);
textcolor(RED);

cprintf("################################################");
gotoxy(25,7);
textcolor(RED+BLINK);
cprintf(" FOR WITHDRAW AMOUNT ");
gotoxy(19,9);

cout<<"################################################";
gotoxy(21,12);
textcolor(RED);
cprintf(" Enter The Account Number ");
cin>>account_number;
file1.seekg(0,ios::beg);
file1.read((char*)&b1,sizeof(b1));
while(!file1.eof())
{
if(account_number !=b1.account_number)
{
file2.write((char*)&b1,sizeof(b1));
}
else
{
show_data();
getch();
int wid=0;
gotoxy(21,30);
cout<<" Enter Withdraw Amount= ";
cin>>wid;
balance=b1.amount;
balance=balance-wid;
gotoxy(21,33);
cout<<" Current Balance= "
<<balance;
b1.amount=balance;
file2.write((char*)&b1,sizeof(b1));
getch();
}
file2.flush();
file1.read((char*)&b1,sizeof(b1));

}
file1.close();
file2.close();
remove("bank.txt");
rename("temp.txt","bank.txt");
getch();
}

//||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
||||||||
// MODIFY RECORD FUNCTION OF THE PROGRAM
//||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
||||||||
void modify()
{
int account_number;
fstream file1,file2;
clrscr();
file1.open("bank.txt",ios::in);
file2.open("temp.txt",ios::app);
file1.seekg(0,ios::beg);
file1.read((char*)&b1,sizeof(b1));
box(10,3,70,39);
gotoxy(19,5);
cout<<"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%";
gotoxy(29,7);
cout<<" MODIFY THE RECORD ";
gotoxy(19,9);
cout<<"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%";
gotoxy(20,12);
cout<<" Enter the Account Number: ";
cin>>account_number;
while(!file1.eof())
{
if(account_number!=
b1.account_number)
file2.write((char*)&b1,sizeof(b1));
else
{
show_data();

}
file2.flush();

file1.read((char*)&b1,sizeof(b1));
}
gotoxy(20,30);
cout<<" Want To Update The Record y/n.....\n";
gotoxy(55,30);
char ans;
cin>>ans;
if(ans=='y'||ans=='Y')
{
clrscr();
get_data();
file2.write((char*)&b1,sizeof(b1));
getch();
}
else if(ans=='n'||ans=='N')
{
menu();
}
file1.close();
file2.close();
remove("bank.txt");
rename("temp.txt","bank.txt");
gotoxy(20,30);
cout<<"Your Record Has Been Updated...........";
getch();
}
//**********************************************************
********
// REPORT FUNCTION OF THE PROGRAM
//**********************************************************
********
void report()
{
clrscr();
file.open("bank.txt",ios::in);
file.seekg(0,ios::beg);
file.read((char*)&b1,sizeof(b1));
cout<<endl;
while(!file.eof())
{
show_data();
file.read((char*)&b1,sizeof(b1));
}
file.read((char*)&b1,sizeof(b1));
file.close();
gotoxy(19,30);
cout<<"Press any key to continue.........";
getch();
}
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$$$$$
// SEARCH RECORD FUNCTION OF THE PROGRAM
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$$$$$
void search()
{
clrscr();
int account;
int count=0;
box(10,2,67,39);
gotoxy(19,5);
textbackground(BLACK);
textcolor(GREEN);
cprintf("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
gotoxy(25,7);
textcolor(GREEN+BLINK);
textbackground(BLACK);
cprintf(" SEARCH THE RECORD ");
gotoxy(19,9);
textcolor(GREEN);
textbackground(BLACK);

cprintf("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
gotoxy(23,15);
textcolor(CYAN);
textbackground(BLACK);
cprintf(" Enter the Account Number : ");
cin>>account;
file.open("bank.txt",ios::in);
file.seekg(0,ios::beg);
file.read((char*)&b1,sizeof(b1));
while(!file.eof())
{
if(b1.account_number==account)
{
count++;
show_data();
getch();
}
file.read((char*)&b1,sizeof(b1));
}
file.close();
gotoxy(30,31);
cout<<"Record Found" <<count;
getch();
}

//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!
// MAIN MENU OF THE PROGRAM
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!
void menu()
{
clrscr();
int ch;
box(10,2,67,40);
gotoxy(13,5);
textbackground(CYAN);
textcolor(BLACK);

cprintf("|||||||||||||||||||||||||||||||||||||||||||||||||||
");
textbackground(BLACK);
gotoxy(25,7);
textcolor(YELLOW+BLINK);
cprintf(" ***** MAIN MENU ***** ");
textcolor(GREEN);
gotoxy(13,9);
textbackground(CYAN);
textcolor(BLACK);

cprintf("|||||||||||||||||||||||||||||||||||||||||||||||||||
");
textbackground(BLACK);
textcolor(RED);
gotoxy(19,14);
cprintf(" Press: 1. OPEN A NEW ACCOUNT ");
gotoxy(19,17);
cprintf(" Press: 2. CLOSE THE ACCOUNT ");
gotoxy(19,20);
cprintf(" Press: 3. DEPOSIT ");
gotoxy(19,23);
cprintf(" Press: 4. WITHDRAW ");
gotoxy(19,26);
cprintf(" Press: 5. MODIFY ");
gotoxy(19,29);
cprintf(" Press: 6. REPORT ");
gotoxy(19,32);
cprintf(" Press: 7. SEARCH THE ACCOUNT ");
gotoxy(70,3);
cprintf("<0>=EXIT");
gotoxy(23,43);
cprintf(" ENTER YOUR CHOICE............ ");
cin>>ch;
do
{
switch(ch)
{
case 1:
add_object();
break;
case 2:
delete_account();
menu();
break;

case 3:
deposit();
menu();
break;

case 4:
withdraw();
menu();
break;

case 5:
modify();
menu();
break;

case 6:
report();
menu();
break;

case 7:
textcolor(CYAN);
search();
menu();
break;

case 0:
clrscr();
gotoxy(25,20);
textcolor(YELLOW+BLINK);
cprintf("::::::::::THANKS TO
VISIT::::::::::");
getch();
exit(2);
}
}
while(ch!=0);
}
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&
// DECLARE THE MAIN FUNCTION OF THE PROGRAM
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&

void main()
{
clrscr();
int pass;
int i;
gotoxy(20,28);
textcolor(RED);
cprintf(" ENTER THE PASSWORD :- ");
cin>>pass;
if(pass==8888)
{
clrscr();
welcome();
gotoxy(1,50);
textcolor(WHITE);
cprintf(" Loading ");
for(int i=0;i<=68;i++)
{
textcolor(WHITE);
cprintf(".");delay (200);
}
introduction();
menu();
}
else
gotoxy(25,37);
textcolor(YELLOW+ BLINK);
cprintf(" WRONG PASSWORD ");
getch();
}
.}

Anda mungkin juga menyukai