Add a function in your BaraBitKaar class from previous assignment as follows
BaraBitKaar Add(BaraBitKaar b);
When this function called in main() like following example:
BaraBitKaar p( "01111111111100000000000001111111101010100101111111111111111111111111111111111111111111111111111111111011111101110101111101011011");
BaraBitKaar q( "00111111111100000000000001111111101010100101111111111111111111111111111111111111111111111111111111111011111101110101111101011011");
BaraBitKaar r;
r = p.Add(q); //this is how Add is supposed to be used to add p and q. Notice r receives the return which is of type BaraBitKaar.
r.PrintBinary(); //
should be able to add numbers p and q and put the result in r.
make a new function Subtract in class BaraBitkaar i.e.
BaraBitKaar Subtract(BaraBitKaar b);
BaraBitKaar Multiply(BaraBitKaar b);
void Divide(BaraBitKaar b,
Comments
Leave a comment