Website Summary Files Commits Branches @commit @diff @stats
path: root / src
diff options
context:
space:
mode:
Commitc24eb091ef16ff87e5363e3b364b59bb92c113a8 (patch)
Author
 Syndamia <kamen@syndamia.com>
2022-05-29 10:04:24 +0300
Committer
 Syndamia <kamen@syndamia.com>
2022-05-29 10:04:24 +0300
Files6b8889184ea458d1283ed3debefab0eeef443013 /src
FMI-OOP-P2_Tables-c24eb091ef16ff87e5363e3b364b59bb92c113a8.tar
FMI-OOP-P2_Tables-c24eb091ef16ff87e5363e3b364b59bb92c113a8.tar.gz
FMI-OOP-P2_Tables-c24eb091ef16ff87e5363e3b364b59bb92c113a8.zip
Parent0040102741289c225065a61263b266f640ddf6c7 (diff)
Autocommit at 29.05.2022 @ 10:04
2 files changed, 5 insertions, 5 deletions
-rw-r--r--src/Models/CellFormula.cpp7
-rw-r--r--src/main.cpp3
diff --git a/src/Models/CellFormula.cpp b/src/Models/CellFormula.cpp
index 388af73..ecea06d 100644
--- a/src/Models/CellFormula.cpp
+++ b/src/Models/CellFormula.cpp
@@ -35,7 +35,7 @@ double CellFormula::calculate(unsigned index) {
CellFormula::CellFormula(const char* str, const List<List<Cell*>>* tableCells) : localCells(), formula(), rawFormula() {
this->tableCells = tableCells;
- parseAndSetValue(str);
+ CellFormula::parseAndSetValue(str);
}
#include <iostream>
@@ -45,6 +45,7 @@ double CellFormula::getNumeralValue() {
}
String CellFormula::getValueForPrint() {
+ std::cout << formula.get_count() << std::endl;
return String() += calculate();
}
@@ -61,7 +62,7 @@ void CellFormula::parseAndSetValue(const char* str) {
unsigned row = atoi(++str);
while (*str != 'C') str++;
unsigned col = atoi(++str);
- while (*str != ' ') str++;
+ while (*str != ' ' && *str != '\0') str++;
while (*str == ' ') str++;
cellToAdd = (*tableCells)[row][col];
@@ -82,8 +83,6 @@ void CellFormula::parseAndSetValue(const char* str) {
if (prev.right == '*' || prev.right == '/') prev.right *= -1;
}
- std::cout << formula.get_count() << std::endl;
- std::cout << cellToAdd << " " << currOp << std::endl;
formula.add({cellToAdd, currOp});
}
}
diff --git a/src/main.cpp b/src/main.cpp
index d716787..7827f8d 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -4,7 +4,8 @@ int main() {
Table table(5, 5);
table.putCell(0, 0, "8");
table.putCell(0, 1, "3");
- table.putCell(0, 2, "= 9 * 10 + R0C0 * R0C1");
+ table.putCell(0, 2, "String");
+ table.putCell(0, 3, "= 9 * 10 + R0C0 * R0C1");
UserInterface ui(&table);
ui.run();
}