Answer to Question #310438 in C++ for Badlyneeded

Question #310438

Create a class with two public integers and functions for reading and displaying the sum of two numbers. 


1
Expert's answer
2022-03-12T12:46:18-0500




#include <iostream>


using namespace std;


class Integers{
private:
	int number1;
	int number2;


public:
	void read(){
		cout<<"Ente number1: ";
		cin>>number1;
		cout<<"Ente number2: ";
		cin>>number2;
	}


	void display(){
		cout<<"The sum of two numbers: "<<(number1+number2)<<"\n\n";
	}
};




//The start point of the program
int main(){
	
	Integers integers;
	integers.read();
	integers.display();


	system("pause");
	return 0;
}

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