SOURCE CODE;- 
#include <iostream>                                              
using namespace std;
class bankaccount
{
private:
    int accountnumber;
    float
balance=10000 ;
float half=balance/2;
public:
    void input()
    {
        cout<<"account
number:";
   
cin>>accountnumber;
   
cout<<"your present
balance:"<<balance<<endl;
cout<<" half of your money
is="<<half<<endl;
    }
    void deposit(float
amount)
    {
       
cout<<"amount to deposit:";
       
cin>>amount;
        balance=balance+amount;
       
cout<<"balance:"<<balance<<endl;
  }
void withdrawl(float amount)
   {
      
cout<<"amount to withdraw:";
    cin>>amount;
   
balance=balance-amount;
   
cout<<"new balance is:"<<balance<<endl;
   }
};
int main()
{
int x;
bankaccount obj;
obj.input();
cout<<"enter 1 to deposit or any other key to
withdraw::";
cin>>x;
if(x==1)
    obj.deposit(1000);
    else
       
obj.withdrawl(1000);
return 0; 
}
OUTPUT OF THE PROGRAM:- 
 
No comments:
Post a Comment