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 code (and code like it):
// sample code
Adder sum1; // sum1 is initialized to 0
Adder sum2(2); // sum2 is initialized to 2
cout << "sum1 is " << sum1 << 'n'; // prints "sum1 is 0"
cout << "sum2 is " << sum2 << 'n'; // prints "sum2 is 2"
sum1 += 5; // adds 5 to sum1; now sum1 is 5
sum2 += -3; // adds -3 to sum2; now sum2 is -1
if (sum1 == sum2)
cout << "sum1 and sum2 are the samen";
You should only write the functions that are necessary for Adder to be used as in the above program. Use const wherever appropriate, and do not write or use a cast operator. Make sure to include any necessary header files.