My problem is that I know how to make a separate function to add and stuff, and another one to show the output. But I am asked to add them(overload the objects) from main and I can only use a different function to display.If this is not possible in c++ maybe I misinterpreted. This is what I have so far. I honestly don't know where to go from here.
#include <iostream>
class decimalClass
{
private: // list the data members
double integerPart;
double decimalPart ;
public:
decimalClass (int m = 0, int n = 0)
{
integerPart = m;
decimalPart =n;
};
void show();
};
int main()
{
decimalClass num1(23, 45);
decimalClass num2(15, 80);
decimalClass num3(10, 27);
decimalClass num4(13, 67);

New Topic/Question
Reply



MultiQuote





|