Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Models / CellFormula.cpp
diff options
context:
space:
mode:
Commit4568c66ae7cd3a18cf3443e6c29b8154af60c708 (patch)
Author
 Syndamia <kamen@syndamia.com>
2022-06-14 07:58:37 +0300
Committer
 Syndamia <kamen@syndamia.com>
2022-06-14 07:58:37 +0300
Files6a0bdc19ddc307498f8b8d886718fd4571072cdd /src/Models/CellFormula.cpp
FMI-OOP-P2_Tables-4568c66ae7cd3a18cf3443e6c29b8154af60c708.tar
FMI-OOP-P2_Tables-4568c66ae7cd3a18cf3443e6c29b8154af60c708.tar.gz
FMI-OOP-P2_Tables-4568c66ae7cd3a18cf3443e6c29b8154af60c708.zip
Parent0154b6953d8c26bb7fc9a9314d9bc02c022547a3 (diff)
Autocommit at 14.06.2022 @ 07:58
1 files changed, 2 insertions, 2 deletions
-rw-r--r--src/Models/CellFormula.cpp4
diff --git a/src/Models/CellFormula.cpp b/src/Models/CellFormula.cpp
index 95fc3eb..92bb701 100644
--- a/src/Models/CellFormula.cpp
+++ b/src/Models/CellFormula.cpp
@@ -25,7 +25,7 @@ double CellFormula::calculate(unsigned index) const {
switch (-formula[index++].right) {
case '+' : numVal += ptrByInd(formula[index].left)->getNumeralValue(); break;
case '*' : numVal *= ptrByInd(formula[index].left)->getNumeralValue(); break;
- case '/' : if (ptrByInd(formula[index].left)->getNumeralValue() == 0) throw std::logic_error("");
+ case '/' : if (ptrByInd(formula[index].left)->getNumeralValue() == 0) throw std::logic_error("Error: Divion by zero!");
numVal /= ptrByInd(formula[index].left)->getNumeralValue(); break;
case '^' : numVal = pow(numVal, ptrByInd(formula[index].left)->getNumeralValue()); break;
}
@@ -36,7 +36,7 @@ double CellFormula::calculate(unsigned index) const {
case '+' : return numVal + calculate(++index);
case '*' : return numVal * calculate(++index);
case '/' : temp = calculate(++index);
- if (temp == 0) throw std::logic_error("");
+ if (temp == 0) throw std::logic_error("Error: Division by zero!");
return numVal / temp;
case '^' : return pow(numVal, calculate(++index));
case '\0' :