MULTIPLE INHERITANCE






Program

#include “iostream.h”
#include “conio.h”
#include
const int max=50;
static int n;
class cust
{
public:
int cno[max];
char cname[max][15],cst[max][15],cares[max][15],ccity[max][15];
float camt[max];
void getdet();
};
class acc
{
protected:
int no;
float amt;
public:
void getamt();
};
class tran:public cust,public acc
{
public:
int op;
void tra();
void disp();
};
void cust::getdet()
{
for(int i=0;i<1;i++)>> cno[n];
cout << "\n enter the name"; cin >> cname[n];
camt[n]=0;
}
cout << "\n" <<>> no;
cout << "enter the amt:"; cin >> amt;
}
void tran::tra()
{
int op,c,i=0;
cout << "enter the transaction type:[1.credit][2.debit]"; cin >> op;
if(op==1)
{
getamt();
while(i < c="0;" op="="2)" c="1;" balance=" << camt[i]; break; } } if(c!=1) cout << " i="0;">> no;
cout << "\n customer details:"; while(i<=n) { if(cno[i]==no) { cout << "\n:" <<>> ch;
switch(ch)
{
case 1:
t.getdet();
break;
case 2:
t.tra();
break;
case 3:
t.disp();
break;
case 4:
break;
default:
cout << "invalid choice"; } } while(ch!=4); getch(); } Output


MULTIPLE INHERITANCE

1.create
2.transaction
3.display

Enter your choice:1

Enter the acc no: 1

Enter the name Lancy

1 record added

1.create
2.transaction
3.display

Enter your choice:2
Enter the transaction type:[1.credit][2.debit]1

Enter the acc no:1
Enter the amt:2500

1.create
2.transaction
3.display

Enter your choice:2
Enter the transaction type:[1.credit][2.debit]2

Enter the acc no:1
Enter the amt:100
Balance=2400

1.create
2.transaction
3.display

Enter your choice:3
Enter the accno:1

customer details:1
Name:Lancy
Balance:2400

1.create
2.transaction
3.display

Enter your choice:4