Ok I am having an issue with a program. I am in C++ II but my issue is I have not taken C++ I in over a year so I am at a disadvantage...we are working on a program and this is the information we were given and this is what I have so far...
Class Compute
Add(int, int)
Subtract(int, int)
Multiply(int, int)
Data
int num1
int num 2
Need Overload constants
I really am not asking for answers but I am trying to finish the first function which is the add and after that I should be able to figure out the rest but could someone help me through the add function...hopefully this information makes sense
#include <iostream>
#include <string>
using namespace std;
class compute
{
public:
compute();
compute Add(int num1, int num2);
compute(int _num1, int _num2);
compute(int total);
compute(int _num1, int _num2, int total);
private:
int num1, num2;
int endingTotal;
};
//Constructor
compute::compute()
{
num1 = 0;
num2 = 0;
endingTotal = 0;
}
compute::compute(int _num1, int _num2)
{
num1 = _num1;
num2 = _num2;
}
compute::compute(int total)
{
endingTotal = total;
}
compute::compute(int _num1, int _num2, int total)
{
compute Add(_num1, _num2, total);
}
void compute::Add(int num1, int num2, int total)
{
num1 = _num1;
num2 = _num2;
total = endingTotal;
}
void compute::Add()
{
compute total;
cout << "Enter number 1 " << endl;
cin >> num1;
cout << "Enter number 2 " << endl;
cin >> num2;
cout << "The amount is ";
cin >> total;
cout << endl;
return 0;
}
I apologize if I did not do these code tags correctly