From 99af5da3777f5cb746a77e9f5d4523d4ecf79c6e Mon Sep 17 00:00:00 2001 From: rhinemann Date: Thu, 10 Oct 2024 18:43:08 +0300 Subject: [PATCH] add a multiplication operation Add a member-function which performs multiplication of two float point digits. Signed-off-by: Sergii Piatakov --- calculator.cpp | 5 +++++ calculator.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/calculator.cpp b/calculator.cpp index d10f529..df0040b 100644 --- a/calculator.cpp +++ b/calculator.cpp @@ -9,3 +9,8 @@ int Calculator::Sub (double a, double b) { return Add (a, -b); } + +int Calculator::Mul (double a, double b) +{ + return a * b + 0.5; +} diff --git a/calculator.h b/calculator.h index d59d596..bd40bcd 100644 --- a/calculator.h +++ b/calculator.h @@ -6,6 +6,8 @@ class Calculator public: int Add (double, double); int Sub (double, double); + int Mul (double, double); +>>>>>>> e0ea21b (add a multiplication operation) }; #endif//CALCULATOR_H