View My Stats

Total Pageviews

Tuesday, 8 October 2013

advanced banking system project for 12th cbse

PHAZE-1:
#include<stdio.h>
#include<conio.h>
#include<fstream.h>
#include<stdlib.h>
#include<process.h>
#include<string.h>
class staff
{
int regno;
char name[40];
char desig;
char pass[10];
public:
int return_regno(void)
{
return regno;
}
void staff::getdata(void)
{
cout<<"enter the registration  no"<<endl;
cin>>regno;
cout<<"enter the name"<<endl;
gets(name);
cout<<"enter the desig in characters"<<endl;
cin>>desig;
cout<<"enter the password"<<endl;
gets(pass);
}
void staff::putdata(void)
{
cout<<"the details entered are"<<endl;
cout<<"reg no"<<regno<<endl;
cout<<"name :"<<name<<endl;
cout<<"desig :"<<desig<<endl;
cout<<"password :"<<pass<<endl;
}}s;
void main()
{
clrscr();
char pass1[10],pass2[10],choice,ch;
int ch1;
choice='y';
ch='y';
cout<<"are u the bank admin y/n"<<endl;
cin>>ch;
if(ch=='y')
{cout<<"only one chance is given to fill in the details"<<endl;
cout<<"enter the bank security password"<<endl;
gets(pass1);
if(strcmp(pass1,"password")==0)
{cout<<"security question :"<<endl;
cout<<"bank owner's locker name"<<endl;
gets(pass2);
if(strcmp(pass2,"banker")==0)
{while(choice=='y')
{cout<<"enter 1 to enter the details"<<endl;
cout<<"enter 2 to delete the details"<<endl;
cout<<"enter 3 to display the details"<<endl;
cin>>ch1;
switch(ch1)
{
case 1 :
{cout<<"enter the details of staffs"<<endl;
cout<<"details once filled cannot be changed"<<endl;
ofstream fin;
fin.open("staff.dat",ios::app);
{s.getdata();
fin.write((char*)&s,sizeof(s));
}fin.close();
break;
}
case 2:
{
char found='n';
ifstream fi("staff.dat");
ofstream file("temp.dat");
int rno;
cout<<"enter the regisration no"<<endl;
cin>>rno;
fi.seekg(0);
while(!fi.eof())
{
fi.read((char*)&s,sizeof(s));
if(s.return_regno()==rno)
found='y';
else
{
file.write((char*)&s,sizeof(s));
}
}
if(found=='n')
cout<<"roll no not found!!!"<<endl;
fi.close();
file.close();
remove("staff.dat");
rename("temp.dat","staff.dat");
break;
}
case 3:
{
ifstream file("staff.dat");
file.seekg(0);
while(!file.eof())
{file.read((char*)&s,sizeof(s));
s.putdata();
}
file.close();
break;
}}
cout<<"do u want to enter more y/n"<<endl;
cin>>choice;
}}
else
{cout<<"sorry wrong reply try again later"<<endl;
exit(0);
}
}
else
{cout<<"sorry  wrong password try again later"<<endl;
exit(0);
}
}
else
{cout<<"sorry access denied only bank owner can access  "<<endl;
exit(0);
}
getch();
}

PHAZE-2:

#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<process.h>
#include<fstream.h>
#include<ctype.h>
#include<string.h>
class staff
{
int regno;
char name[40];
char desig;
char pass[10];
public:
int return_regno(void)
{
return regno;
}
char* return_pass(void)
{
return pass;
}
}s;
class account
{
 int acno;
 char name[50];
 int deposit, withdraw;
 char type;
 public:
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;}

};




 fstream fp;
 account ac;




void write_account()
{
fp.open("account.dat",ios::out|ios::app);
ac.create_account();
fp.write((char*)&ac,sizeof(account));
fp.close();
}




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();
}




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();
}




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();
}

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;
 }

 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();
}

void deposit_withdraw(int option)
{
int no,found=0,amt;
clrscr();
cout<<"\n\n\tEnter 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\n\tTO DEPOSITE AMOUNT ";
cout<<"\n\nEnter The amount to be deposited";
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;
if((bal<500 && ac.rettype()=='S') || (bal<1000 && ac.rettype()=='C'))
cout<<"Insufficience 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();
}



void intro()
{
 clrscr();
 gotoxy(31,11);
 cout<<"BANKING";
 gotoxy(35,14);
 cout<<"TRANSACTIONS";
 gotoxy(35,17);
 cout<<"SYSTEM";
 cout<<"\n\nMADE BY : kaaliraj and prathik g.s";
 cout<<"\n\nSCHOOL :  sindhi high school";
 getch();

}


void main()
{
  char ch,choice;
  intro();
  choice='y';
while(choice=='y')
{
 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();
 int rno;
 char paas[10];
 ifstream file("staff.dat");
 cout<<"enter the registration no"<<endl;
 cin>>rno;
 file.seekg(0);
 while(!file.eof())
 {
 if(s.return_regno()==rno)
 {if(rno==1000)
 {cout<<"enter the pasword"<<endl;
 gets(paas);
 if(strcmp(paas,s.return_pass())==0)
 {
write_account();
 }else
 cout<<"wrong password access denied"<<endl;
 exit(1);
 }
 else
 cout<<"u cannot access this department"<<endl;
 exit(1);
 }
 else
 cout<<"user data not found"<<endl;
 exit(1);
 }
 file.close();
 getch();
break;
 }
case '2':
 {
 clrscr();
 int rno1;
 char paas1[10];
 ifstream file("staff.dat");
 cout<<"enter the registration no"<<endl;
 cin>>rno1;
 file.seekg(0);
 while(!file.eof())
 {
 if(s.return_regno()==rno1)
 {if(rno1==1001)
 {cout<<"enter the pasword"<<endl;
 gets(paas1);
 if(strcmp(paas1,s.return_pass())==0)
 {
deposit_withdraw(1);
 }else
 cout<<"wrong password access denied"<<endl;
 exit(1);
 }
 else
 cout<<"u cannot access this department"<<endl;
 exit(1);
 }
 else
 cout<<"user data not found"<<endl;
 exit(1);
 }
 getch();
break;
 }
case '3':
{
clrscr();
 int rno2;
 char paas2[10];
 ifstream file("staff.dat");
 cout<<"enter the registration no"<<endl;
 cin>>rno2;
 file.seekg(0);
 while(!file.eof())
 {
 if(s.return_regno()==rno2)
 {if(rno2==1002)
 {cout<<"enter the pasword"<<endl;
 gets(paas2);
 if(strcmp(paas2,s.return_pass())==0)
 {
deposit_withdraw(2);
 }else
 cout<<"wrong password access denied"<<endl;
 exit(0);
 }
 else
 cout<<"u cannot access this department"<<endl;
 exit(0);
 }
 else
 cout<<"user data not found"<<endl;
 exit(0);
 }
 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':
 {
 clrscr();
 int rno3;
 char paas3[10];
 ifstream file("staff.dat");
 cout<<"enter the registration no"<<endl;
 cin>>rno3;
 file.seekg(0);
 while(!file.eof())
 {
 if(s.return_regno()==rno3)
 {if(rno3==1003)
 {cout<<"enter the pasword"<<endl;
 gets(paas3);
 if(strcmp(paas3,s.return_pass())==0)
 {
delete_account();
 }else
 cout<<"wrong password access denied"<<endl;
 exit(0);
 }
 else
 cout<<"u cannot access this department"<<endl;
 exit(0);
 }
 else
 cout<<"user data not found"<<endl;
 exit(0);
 }
 getch();
 break;
}
case '7': {

 clrscr();
 int rno4;
 char paas4[10];
 ifstream file("staff.dat");
 cout<<"enter the registration no"<<endl;
 cin>>rno4;
 file.seekg(0);
 while(!file.eof())
 {
 if(s.return_regno()==rno4)
 {if(rno4==1004)
 {cout<<"enter the pasword"<<endl;
 gets(paas4);
 if(strcmp(paas4,s.return_pass())==0)
 {
modify_account();
getch();
 }else
 cout<<"wrong password access denied"<<endl;
 exit(0);
 }
 else
 cout<<"u cannot access this department"<<endl;
 exit(0);
 }
 else
 cout<<"user data not found"<<endl;
 exit(0);
 }
 getch();
 break;
}

case '8':exit(0);
 default :cout<<"\a";
}
}
cout<<"do u want to continue y/n"<<endl;
    cin>>choice;
}

No comments:

Post a Comment