Website Summary Files Commits Branches @commit @diff @stats
path: root / src
diff options
context:
space:
mode:
Commit7571a449b3f90e3f723488f167c25a3d095e0093 (patch)
Author
 Syndamia <kamen@syndamia.com>
2022-05-29 15:05:19 +0300
Committer
 Syndamia <kamen@syndamia.com>
2022-05-29 15:05:19 +0300
Files2a2eb796cbdaee20c038e5d765e2493793ef72c3 /src
FMI-OOP-P2_Tables-7571a449b3f90e3f723488f167c25a3d095e0093.tar
FMI-OOP-P2_Tables-7571a449b3f90e3f723488f167c25a3d095e0093.tar.gz
FMI-OOP-P2_Tables-7571a449b3f90e3f723488f167c25a3d095e0093.zip
Parentbc8cc2c75177151a8238ff13485127ac300d52e5 (diff)
Autocommit at 29.05.2022 @ 15:05
2 files changed, 3 insertions, 3 deletions
-rw-r--r--src/Models/CellFormula.cpp4
-rw-r--r--src/main.cpp2
diff --git a/src/Models/CellFormula.cpp b/src/Models/CellFormula.cpp
index fcc71a9..1ebc6d6 100644
--- a/src/Models/CellFormula.cpp
+++ b/src/Models/CellFormula.cpp
@@ -19,7 +19,7 @@ double CellFormula::calculate(unsigned index) {
switch (-formula[index++].right) {
case '+' : lval += formula[index].left->getNumeralValue(); break;
case '*' : lval *= formula[index].left->getNumeralValue(); break;
- case '/' : if (formula[index].left->getNumeralValue() == 0) throw new std::logic_error("");
+ case '/' : if (formula[index].left->getNumeralValue() == 0) throw std::logic_error("");
lval /= formula[index].left->getNumeralValue(); break;
case '^' : lval = pow(lval, formula[index].left->getNumeralValue()); break;
}
@@ -30,7 +30,7 @@ double CellFormula::calculate(unsigned index) {
case '+' : return lval + calculate(++index);
case '*' : return lval * calculate(++index);
case '/' : temp = calculate(++index);
- if (temp == 0) throw new std::logic_error("");
+ if (temp == 0) throw std::logic_error("");
return lval / temp;
case '^' : return pow(lval, calculate(++index));
case '\0' :
diff --git a/src/main.cpp b/src/main.cpp
index f9ee337..aa26856 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -3,7 +3,7 @@
int main() {
Table table(5, 5);
table.putCell(0, 0, "8.6");
- table.putCell(0, 1, "3");
+ table.putCell(0, 1, "0");
table.putCell(0, 2, "String");
table.putCell(0, 3, "= 3 * R0C1 + R0C0 ^ R0C1 * 27 / R0C1 - 2 * 2.5 * 2 * 2 + R0C2 ^ R0C2");
// table.putCell(0, 3, "= 1 + 2 * 3 + 4 + 5");