PROGRAM :
#include <iostream>OUTPUT :
#include <string.h>
using namespace std;
class addition
{
private:
int var1, var2, result;
public:
void getValue();
int addOperation();
};
void addition :: getValue()
{
cout << "Enter the first value : " << " ";
cin >> var1;
cout << "Enter the second value : " << " ";
cin >> var2;
}
int addition :: addOperation()
{
result = var1 + var2;
return result;
}
int main(int argc, char *argv[])
{
addition obj1;
int output = 0;
obj1.getValue();
output = obj1.addOperation();
cout << "Result : " << output << endl;
return 0;
}
Enter the first value :
25
Enter the second value :
30
Result : 55
alternative link download