Breaking News

C++ Program To Divide Two Numbers Using Class

Before i showed you to divide two numbers but now ill show you to divide two numbers but by using class
Algorithm :
1.Start
2.Define A Class divide
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 divide
8.Access the member functions of the class product through the object created for that particular class
9.Stop
Program :
#include<iostream.h>
#include<conio.h>
class divide
{
           int a,b;
           Public :
                   Void getput()
                    {
                             cout<<"Enter Two Numbers           To DIVIDE :";
                             cin>>a>>b;
                             cout<<"Division ="<<a/b;
                     }
};
void main()
{
        divide d1; // object created for class
        d1.getput();
        getch();
}

No comments