Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Models / CellFormula.cpp
diff options
context:
space:
mode:
Commit6aa0aed3d8f81cd923080ed7428d344e115c47ea (patch)
Author
 Syndamia <kamen@syndamia.com>
2022-05-29 10:19:29 +0300
Committer
 Syndamia <kamen@syndamia.com>
2022-05-29 10:19:29 +0300
Files85abef83e9f75202627bbc9b0631b5e61d144a6b /src/Models/CellFormula.cpp
FMI-OOP-P2_Tables-6aa0aed3d8f81cd923080ed7428d344e115c47ea.tar
FMI-OOP-P2_Tables-6aa0aed3d8f81cd923080ed7428d344e115c47ea.tar.gz
FMI-OOP-P2_Tables-6aa0aed3d8f81cd923080ed7428d344e115c47ea.zip
Parentcd40b3479f8ce874cc69663b7318dc9f033ed1f1 (diff)
Autocommit at 29.05.2022 @ 10:19
1 files changed, 6 insertions, 3 deletions
-rw-r--r--src/Models/CellFormula.cpp9
diff --git a/src/Models/CellFormula.cpp b/src/Models/CellFormula.cpp
index 72c2a99..5f9913b 100644
--- a/src/Models/CellFormula.cpp
+++ b/src/Models/CellFormula.cpp
@@ -3,10 +3,11 @@
#include <cstring>
double pow(double x, unsigned y) {
- double res = x;
+ if (y == 0) return 1;
+
for (unsigned i = 1; i < y; i++)
- res *= res;
- return res;
+ x *= x;
+ return x;
}
double CellFormula::calculate(unsigned index) {
@@ -45,6 +46,8 @@ double CellFormula::getNumeralValue() {
}
String CellFormula::getValueForPrint() {
+ for (unsigned i = 0; i < formula.get_count(); i++)
+ std::cout << "[" << formula[i].left->getNumeralValue() << " " << -formula[i].right << std::endl;
return String() += calculate();
}