C++ Program To Subtract Two Numbers Using Class

Before i showed you to subtract two numbers but now ill show you to subtract two numbers but by using class

Algorithm :


2.Define A Class sub

3.Get Input for two variables example a and b

4.Declare member function named getput()

5.In function getput() read two variables

6.After reading the variables print the result directly

7.In main function create an object for class sub

8.Access the member functions of the class product through the object created for that particular class


Program :

class sub
           int a,b;
           Public :
                   Void getput()
                             cout<<"Enter Two Numbers           To Subtract :";
                             cout<<"subtraction ="<<a-b;
void main()
        sub s1; // object created for class

Manish Jain

Manish Jain is an indian blogger who loves to learn and find out interesting tweaks and tricks on pc and smartphones and share them with world .