Write a class called Adder that stores the sum of all the ints given to it. Your Adder class should allow you to write the following main function (and code like it):
cin >> x >> y;
Adder sum1; // sum1 is initialized to 0
Adder sum2(x); // sum2 is initialized to x
Adder sum3(y); // sum1 is initialized to y
cout << "sum1 is " << sum1 << '\n'; // prints "sum1 is 0"
cout << "sum2 is " << sum2 << '\n'; // prints "sum2 is x"
cout << "sum3 is " << sum3 << '\n'; // prints "sum3 is y"
sum1 += x; //adds x to sum1; now sum1 is x
sum2 += -3; // adds -3 to sum2; now sum2 is x-3
sum3 += 2; //adds 2 to sum3; now sum3 is y+2
if (sum1 == sum2)
cout << "sum1 and sum2 are the same\n";
else cout << "sum1 and sum2 are not the same\n";
if (sum1 == sum3)
cout << "sum1 and sum3 are the same\n";
else cout << "sum1 and sum3 are not the same\n";
You should write the functions that are necessary for Adder to be used as in the above program. Combine them all together in your answer to make a perfect program. Use const wherever appropriate, and do not write or use a cast operator. Make sure to include any necessary header files.