sys-prog-coursework-lab-1/calculator.cpp

26 lines
358 B
C++
Raw Normal View History

#include "calculator.h"
int Calculator::Add (double a, double b)
{
return a + b + 0.5;
}
int Calculator::Sub (double a, double b)
{
return Add (a, -b);
}
int Calculator::Mul (double a, double b)
{
return a * b + 0.5;
}
2024-10-10 19:13:51 +03:00
double Calculator::Pow(double a, int n)
{
double result = 1;
for (int i = 0; i < n; i++) {
result *= a;
}
return result;
}