/* C++ Program To Perform Arithmetic Operation Using Class And Object */
#include <iostream>
using namespace std;
class arithmetic
{
float a,b,sum,div,mul,diff;
public:
void getdata();
void putdata();
};
void arithmetic::getdata()
{
cout<<"Enter The Value For Two Numbers:"<<endl;
cin>>a>>b;
}
void arithmetic::putdata()
{
sum=a+b;
cout<<"Sum Of Two Numbers:"<<sum<<endl;
diff=a-b;
cout<<"Difference Of Two Numbers:"<<diff<<endl;
mul=a*b;
cout<<"Product Of Two Numbers:"<<mul<<endl;
div=a/b;
cout<<"Division Result:"<<div<<endl;
}
int main()
{
arithmetic a;
a.getdata();
a.putdata();
return 0;
}
No comments:
Post a Comment