diff options
1 files changed, 5 insertions, 0 deletions
| -rw-r--r-- | src/Models/CellInt.cpp | 5 |
diff --git a/src/Models/CellInt.cpp b/src/Models/CellInt.cpp index 827f346..a20c5ed 100644 --- a/src/Models/CellInt.cpp +++ b/src/Models/CellInt.cpp @@ -7,8 +7,13 @@ CellInt::CellInt(int value) { CellInt::CellInt(const char* str) { value = 0; + bool negative = *str == '-'; + if (*str == '-' || *str == '+') str++; + while (*str != '\0') value = value * 10 + '0' - *(str++); + + if (negative) value *= -1; } double CellInt::getNumeralValue() const { |
