C++ Programming Blog

 
 
 
#include<iostream.h>
#include<conio.h>
class account
{
    public:
        int bal;
        void deposit(int amt);
        void withdraw(int amt);
        void disp_bal();
};

main()
{
    clrscr();
    account a1,a2;
    //accounts b1;
    a1.bal=1000;
    a1.deposit(300);
    a1.withdraw(300);
    a1.disp_bal();
    a2.bal=500;
    a2.deposit(200);
    a2.withdraw(300);
    a2.disp_bal();
}


void account::deposit(int amt)
{
    bal=bal+amt;
}
void account::withdraw(int amt)
{
    bal=bal-amt;
}
void account::disp_bal()
{
    cout<<\"Balance is : \"<<bal<<endl;
}

    Related Post:
  1. Program to show the implementation of Binary Search Tree as Sets

  2. Program to illustrate operator overloading from class to basic type

  3. Projects of Employee Record Keeping System using nested structure

  4. PROGRAM TO IMPLEMENT RECURSIVE DESCENT PARSER

  5. Program to copy n number of characters from one string to another at position p

  6. Shortest Path using kruskal algorithm

  7. Program to illustrate an example of Inheritance

  8. Program that reads marks obtained by a student in a test of 100 marks and computes his grade

  9. Program to show the implementation of Hashing with Insert, Delete and search functionality using double-ended Linked List

  10. Program of traversing a binary tree in inorder iteratively

  11. Program to illustrate the binary operator(+) overloading without creating a new object

  12. Program to implement the Kurskals Algorithm to solve Minimum Cost Spanning Tree Problem (MST)

  13. Program to draw a line using Cartesian Slope-Intercept Equation [ Simple Implementation ]

  14. Scanner of valide variable name in c

  15. Program to illustrate the implementation of Translation Transformation.

  16. Program to estimate value of First Derivative of the function at the given points from the given data using Backward Difference Formula , Forward diff

  17. Program to initialize array by even numbers starting from 2 and display sum of all elements

  18. Program to illustrate the declaration , initialization and printing a constant variable

  19. Program to search an element in an array using Binary search

  20. Program that maintains library shop stock using link list

 
 
Didn't find what you were looking for? Find more on Program that provides an example of class