Answer to Question #269348 in C++ for Moh

Question #269348

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


1
Expert's answer
2021-11-21T04:57:39-0500
#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();
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS