1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
|
#include<iostream.h>
#include<conio.h>
#include<string.h>
class bank_entry
{
protected:
char ac_holder,address;
long int ac_no,transaction_id,pincode,phone_no,balance;
static long int count1,count2;
public:
bank_entry()
{
balance=0;
}
void getac_holder()
{
cout<<"enter your name ";
cin>>ac_holder;
}
void getaddress()
{
cout<<"enter your address ";
cin>>address;
}
void getpincode()
{
cout<<"enter pincode ";
cin>>pincode;
}
void getac_no()
{
ac_no=count1;
count1++;
}
void gettransaction_id()
{
transaction_id=count2;
}
void getphone_no()
{
cout<<"enter your phone no: ";
cin>>phone_no;
}
void print()
{
cout<<ac_holder<<endl<<address<<" "<<pincode<<endl<<ac_no<<endl<<transaction_id;
}
};
long int bank_entry::count1=10000;
long int bank_entry::count2=556562;
class bank_find:public bank_entry
{
protected:
long int ac_no1,ac_no2,transaction_id_find,amount;
public:
void getac_no1()
{
cout<<"enter your a/c no: ";
cin>>ac_no1;
}
void getac_no2()
{
cout<<"enter the acount to which money to be transfered ";
cin>>ac_no2;
}
void gettransaction_id_find()
{
cout<<"enter your transacton id: ";
cin>>transaction_id_find;
}
void newbalance(bank_entry &ob)
{
ob.balance+=amount;
}
int compare1(bank_entry &ob)
{
int a=0;
if(ob.ac_no==ac_no1)
{
a=1;
gettransaction_id_find();
if(ob.transaction_id==transaction_id_find)
{
getac_no2();
if(amount<=ob.balance)
{
newbalance(bank_entry &ob);
}
}
}
return a;
}
};
void main()
{
bank_entry detail[100];
bank_find find;
int a,b,i,c;
for(i=0;i<100;i++)
{
detail[i].getac_holder();
detail[i].getaddress();
detail[i].getpincode();
detail[i].getphone_no();
detail[i].getac_no();
detail[i].gettransaction_id();
detail[i].print();
again1:
cout<<"\npress 1 to continue\npress 2 to exit";
cin>>b;
switch(b)
{
case 1:
break;
case 2:
goto end;
default:cout<<"invalid entry";goto again1;
}
}
find.getac_no1();
for(i=0;i<100;i++)
{
b=find.compare1(detail[i]);
if(b==1)
{
c=i;
}
}
find.newbalance(detail[c]);
detail[c].print();
end:
getch();
return 0;
}
|