The function that adds them is given by: In the file that contains the int main ():
add(m1,m2, sum);
cout << "The sum is:";
sum.display_money();
In the .h file:
friend void add(AltMoney m1, AltMoney m2, AltMoney& sum);
In the .cpp file
void add(AltMoney m1, AltMoney m2, AltMoney& sum)
{
int extra = 0;
sum.cents = m1.cents + m2.cents;
if(sum.cents >=100){
sum.cents = sum.cents - 100;
extra = 1;
}
sum.dollars = m1.dollars + m2.dollars + extra;
}
From that implementation I want to subtract one from the other ...
The sum I am calling by reference, but I can not find the logic to subtract.
Thanks for your time and help.