Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class numbers {
- int value1;
- int value2;
- public:
- numbers () {
- value1 = 0;
- value2 = 0;
- }
- void set_values (int input1, int input2) {
- value1 = input1;
- value2 = input2;
- cout << "Values set to " << value1 << " and " << value2 << endl;
- }
- int add () {
- return value1 + value2;
- }
- int multiply () {
- return value1 * value2;
- }
- };
- int main () {
- numbers num1, num2;
- num1.set_values (1, 3);
- num2.set_values (5, 10);
- cout << "num1 Added: " << num1.add () << endl;
- cout << "num1 Multiplied: " << num1.multiply () << endl;
- cout << "num2 Added: " << num2.add () << endl;
- cout << "num2 Multiplied: " << num2.multiply () << endl;
- cout << "Done \n";
- }
Advertisement
Add Comment
Please, Sign In to add comment