Professional Documents
Culture Documents
Computer Investigatory Report On "Bank System"
Computer Investigatory Report On "Bank System"
Computer Investigatory Report On "Bank System"
Supervised by:
SAMYAK SAU
XII ‘A’
void create_account()
{
cout<<"\nEnter The account No.";
cin>>acno;
cout<<"\n\nEnter The Name of The account Holder ";
gets(name);
cout<<"\nEnter Type of The account (C/S) ";
cin>>type;
type=toupper(type);
cout<<"\nEnter The Initial amount(>=500 for Saving and >=1000 for current )";
cin>>deposit;
cout<<"\n\n\nAccount Created..";
}
void show_account()
{
cout<<"\nAccount No. : "<<acno;
cout<<"\nAccount Holder Name : ";
puts(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<<"\nModify Type of Account : ";cin>>type;
cout<<"\nModify 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;
}
};
//***************************************************************
// GLOBAL DECLARATION FOR STREAM 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)
{
clrscr();
cout<<"\nBALANCE DETAILS\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;
clrscr();
cout<<"\n\n\tTo Modify ";
cout<<"\n\n\tEnter The account No. of The account";
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<<"\nEnter The New Details of account"<<endl;
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;
clrscr();
cout<<"\n\n\n\tDelete Record";
cout<<"\n\nEnter The account no. of the customer You Want To Delete";
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()
{
clrscr();
fp.open("account.dat",ios::in);
if(!fp)
{
cout<<"ERROR!!! FILE COULD NOT BE OPEN\n\n\n Go To Admin Menu to create File";
getch();
return;
}
void assign_user()
{
strcpy(admin.user_name, "sausamyak");
strcpy(admin.password, "sausamyak");
}
int verify_password()
{
char u_name[10];
char u_pwd[10],temp[2];
int x=1;
cout<<"\n\n Enter user name : ";
cin>>u_name;
cout<<"\n\n Enter Password : ";
cin>>u_pwd;
x=strcmp(admin.user_name,u_name);
if (x==0)
{
x=strcmp(admin.password,u_pwd);
}
cin.getline(temp,2);
return(x);
}
//***************************************************************
// INTRODUCTION FUNCTION
//***************************************************************
void intro()
{
clrscr();
int z;
cout<<"\t%% %% ";
cout<<"\n\t%% %% %%%%%%% %% %%%%%% %%%%%% %%%% %%%% %%%%%%%";
cout<<"\n\t%% %% %% %% %% %% %% %% %%% %% %% ";
cout<<"\n\t%% %% %% %%%%% %% %% %% %% %% %%% %% %%%%% ";
cout<<"\n\t%% %% %% %% %% %% %% %% %% %% %% ";
cout<<"\n\t%%%%%%%%%% %%%%%%% %%%%%%% %%%%%%% %%%%%% %% %% %%%%%%% ";
cout<<"\n\n\t\t\t $$$$$$$$ $$$$$ ";
cout<<"\n\t\t\t $$ $ $ ";
cout<<"\n\t\t\t $$ $$$$$ ";
cout<<"\n\n\n\tCOMPUTER PROJECT (******** ON BANK SYSTEM *******)";
cout<<"\n\n\t\t\t\t BY :-";
cout<<"\n\n\t\t\t* SAMYAK SAU "<<"\t XII-A *";
cout<<" \n\n\n\t\t press any number and ‘ENTER’ to continue: ";
cin>>z;
}
//***************************************************************
// THANKS FUNCTION
//***************************************************************
void thanks()
{
int w;
clrscr();
cout<<"\n\n\n\n\n\n\n\n\n\n\t********** T H A N K Y O U F O R W O R K I N G *******";
cout<<"\n\n\n\n\n\n\n\t\t\tpress any number and then ‘ENTER’ to exit";
cin>>w;
}
//***************************************************************
// THE MAIN FUNCTION OF PROGRAM
//***************************************************************
void main()
{
char ch;
int p;
assign_user();
p=verify_password();
if(p==0)
{
intro ();
}
else
{
cout<<"\n\tU R Not a Valid User.";
cout<<"\n\tU Dont have the Authority to Access . Bye\n\n";
exit(0);
}
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();
switch(ch)
{
case '1': clrscr();
write_account();
getch();
break;
case '2': clrscr();
deposit_withdraw(1);
break;
case '3': clrscr();
deposit_withdraw(2);
getch();
break;
case '4': int num;
clrscr();
cout<<"\n\n\tEnter The account No. ";
cin>>num;
display_sp(num);
break;
case '5': clrscr();
display_all();
getch();
break;
case '6': delete_account();
break;
case '7': clrscr();
modify_account();
getch();
break;
case '8': thanks();
exit(0);
default : cout<<"\a";
}
}while(ch!='8');
}
//***************************************************************
// END OF PROJECT
//***************************************************************
Computer Science
Luxmi Publications