I am working on a program and need to make a friend, deconstructor, and copy constructor.....
I was given this formula for the destructor and completely confused...
cout << value1 << value2
I also do not seem to see a whole lot of information on copy constructors and friends so was wanting to know if someone can help me in exactly what I have to do for these.....
#include<iostream>
#include<string>
using namespace std;
class Arithmetic
{
public:
int Add(int num1, int num2);
int Subtract(int num1, int num2);
int Multiply(int num1, int num2);
private:
int addedTotal, subtractedTotal, multipliedTotal;
};
//Adding the two numbers together
int Add(int num1, int num2)
{
int addedTotal;
addedTotal = num1 + num2;
cout << endl << "The two numbers added together are: " << addedTotal;
return addedTotal;
}
//Subtracting the two numbers together
int Subtract(int num1, int num2)
{
int subtractedTotal;
subtractedTotal = num1 - num2;
cout << endl << endl << "Subtracting the first and second number give a difference of: " << subtractedTotal << endl ;
return subtractedTotal;
}
//Multiplying the two numbers together
int Multiply(int num1, int num2)
{
int multipliedTotal;
multipliedTotal = num1 * num2;
cout << endl << "Numbers 1 and 2 multiplied together give a product of: " << multipliedTotal << endl << endl;
return multipliedTotal;
}
int main()
{
int num1, num2;
cout << "Enter the first number: ";
cin >> num1;
cout << endl << "Enter the second number: ";
cin >> num2;
Add(num1, num2);
Subtract(num1, num2);
Multiply(num1, num2);
}