C++ Program to add two numbers using class
//C++ Program to add two numbers using class
//header files
#include<iostream.h>
#include<conio.h>
//creating class
class adding
{
int x,y;
public:
void input()
{
cout<<"Enter two numbers to add\n";
cin>>x>>y;
}
void add()
{
cout<<"addition of two numbers:"<<x+y;
}
};
void main()
{
clrscr();
adding a; //creating an object of class
a.input();
a.add();
getch();
}
//Now run the program by ctrl+f9
Output
