From 4568c66ae7cd3a18cf3443e6c29b8154af60c708 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Tue, 14 Jun 2022 07:58:37 +0300 Subject: Autocommit at 14.06.2022 @ 07:58 --- src/Models/CellFormula.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Models/CellFormula.cpp') 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' : -- cgit v1.3.1-23-gd82d