Addition of two no. using Class
Code of addition in c++ using class
#include<iostream.h>
#include<conio.h>
Class addition
{
int a, b, c;
public:
void input()
{
cout<<"Enter two element which you want to add \n";
cin>>a>>b;
}
void output()
{
cout<<"Sum of two no. are: \n";
c=a+b;
cout<<c;
}
void output()
{
cout<<"Sum of two no. are: \n";
c=a+b;
cout<<c;
}
};
void main()
{
addition s1
clrscr();
s1.input();
s1.output();
getch();
}
void main()
{
addition s1
clrscr();
s1.input();
s1.output();
getch();
}
Output:-
Enter two elements which you want to add
2
3
Sum of two no. are:
5
2
3
Sum of two no. are:
5
Comments
Post a Comment