OUTPUT :-
Enter account number : 123
Enter depositor name : RANJIT
Enter balence amount : 2300
-------------------------------
Account number : 123
Depositor name : RANJIT
Balence amount : 2300
-------------------------------
Enter amount for deposit : 5500
-------------------------------
Account number : 123
Depositor name : RANJIT
Balence amount : 7800
Ranjit
18 September, 2009
Main function for BANK
void main()
{
clrscr();
int acno;
char *depos_name;
float bal_amt;
cout<<"\n\nEnter account number : "; cin>>acno;
cout<<"Enter depositor name : "; cin>>depos_name;
cout<<"Enter balence amount : "; cin>>bal_amt;
BANK obj1 = BANK(acno,depos_name,bal_amt);
obj1.show();
float depos_amt;
cout<<"\n-------------------------------"; cout<<"\nEnter amount for deposit : "; cin>>depos_amt;
obj1.deposit(depos_amt);
obj1.show();
getch();
}
{
clrscr();
int acno;
char *depos_name;
float bal_amt;
cout<<"\n\nEnter account number : "; cin>>acno;
cout<<"Enter depositor name : "; cin>>depos_name;
cout<<"Enter balence amount : "; cin>>bal_amt;
BANK obj1 = BANK(acno,depos_name,bal_amt);
obj1.show();
float depos_amt;
cout<<"\n-------------------------------"; cout<<"\nEnter amount for deposit : "; cin>>depos_amt;
obj1.deposit(depos_amt);
obj1.show();
getch();
}
BANK SIMPLE PROGRAMM...
Class name BANK,Data members: Account no, Depositer name, Balance Amount .
Member Function: To assign values( Use Constructor),to deposit amount, To display information…
#include"iostream.h"
#include"conio.h"
#include"string.h"
class BANK
{
private:int ac_no;char *depositor_name;float balence_amt;
public:BANK(int A,char *B,float C)
{ ac_no = A;
strcpy(depositor_name,B);
balence_amt = C;
}
BANK()
{ ac_no = 0;
strcpy(depositor_name,"");
balence_amt = 0;
}
void show();
void deposit(float D)
{balence_amt = balence_amt + D;}
};
Member Function: To assign values( Use Constructor),to deposit amount, To display information…
#include"iostream.h"
#include"conio.h"
#include"string.h"
class BANK
{
private:int ac_no;char *depositor_name;float balence_amt;
public:BANK(int A,char *B,float C)
{ ac_no = A;
strcpy(depositor_name,B);
balence_amt = C;
}
BANK()
{ ac_no = 0;
strcpy(depositor_name,"");
balence_amt = 0;
}
void show();
void deposit(float D)
{balence_amt = balence_amt + D;}
};
Subscribe to:
Posts (Atom)