Write a program in C++ to declare a class measure having data members as add 1, add 2, add 3. Initialize the values of two data members using constructor and display their addition using function.
#include<iostream.h>
#include<conio.h>
class measure
{
public:
int add1,add2,add3;
measure(int a,int b)
{
add1=a;
add2=b;
}
void cal()
{
add3=add1+add2;
}
void display()
{
cout<<"\n Sum="<<add3;
}
};
void main()
{
int a, b;
clrscr();
cout<<"Enter a and b:";
cin>>a>>b;
measure m1(a, b);
m1.cal();
m1.display();
getch();
}