CLASSES WITH STATIC MEMBER FUNCTIONS


SOURCE CODE:
#include<iostream.h>
#include<conio.h>
class s
{
 float deposit,withdrawal;
 static float balance;
 public:
     void dep();
     static void input();
     void withdraw();
};
void s::dep()
{
 cout<<"\nDeposit the amount : ";
 cin>>deposit;
 balance+=deposit;
 }
void s::input()
{
 cout<<"\nYour  Current  Balance  is  Rs."<<balance<<"/-"<<endl;
}
void s::withdraw()
{
 cout<<"\nHow much you want to withdraw?: ";
 cin>>withdrawal;
 balance-=withdrawal;
}
float s::balance=1000;
void main()
{
 s J;
 clrscr();
 J.dep();
 s::input();
 J.withdraw();
 s::input();
 getch();
}

OUTPUT :

Deposit the amount : 1500

Your  Current  Balance  is  Rs.2500/-

How much you want to withdraw? : 2000

Your  Current  Balance  is  Rs. 500/-
Previous
Next Post »

Still not found what you are looking for? Try again here.