add a multiplication operation

Add a member-function which performs multiplication of two float point
digits.

Signed-off-by: Sergii Piatakov <sergii.piatakov@globallogic.com>
This commit is contained in:
Sergii Piatakov 2018-11-15 15:43:25 +02:00 committed by hasslesstech
parent 7c00e575e0
commit 8b7e818d3a
2 changed files with 6 additions and 0 deletions

View File

@ -9,3 +9,8 @@ int Calculator::Sub (double a, double b)
{ {
return Add (a, -b); return Add (a, -b);
} }
int Calculator::Mul (double a, double b)
{
return a * b + 0.5;
}

View File

@ -6,6 +6,7 @@ class Calculator
public: public:
int Add (double, double); int Add (double, double);
int Sub (double, double); int Sub (double, double);
int Mul (double, double);
}; };
#endif//CALCULATOR_H #endif//CALCULATOR_H