Hello my friends,
I'm having some issues with implementing a logarithm class with operator overloading in C++.
My first goal is how I would implement the changeBase
method, I've been having a tough time wrapping my head around it.
I have tried to understand the math behind changing the base of a logarithm, but i haven't been able to. Can someone please explain it to me?
My second goal is to be able to perform an operation where the left operand is a double
and the right operand is a logarithm object.
Here's a snippet of my log class:
// coefficient: double
// base: unsigned int
// result: double
class _log {
double coefficient, result;
unsigned int base;
public:
_log() {
base = 10;
coefficient = 0.0;
result = 0.0;
}
_log operator+ ( const double b ) const;
_log operator* ( const double b ) const;
_log operator- ( const double b ) const;
_log operator/ ( const double b ) const;
_log operator<< ( const _log &b );
double getValue() const;
bool changeBase( unsigned int base );
};
You guys are awesome, thank you for your time.