Develop a c++ program having a class called mathematics used to calculate sum for two integer values. The program should create an object of the class int main ( ) program
#include<iostream>
using namespace std;
class mathematics{
public:
int x, y;
void calculates(){
cout<<"The sum of "<<x<<" and "<<y<<" is "<<x+y;
}
};
int main(){
mathematics ma;
ma.x =50;
ma.y = 60;
ma.calculates();
}
Comments
Leave a comment