diff options
| Commit | 5b8613c8634e2ed9f02d36582ea5bb588955cd95 (patch) | |
|---|---|---|
| Author | 2022-05-30 21:38:48 +0300 | |
| Committer | 2022-05-30 21:38:48 +0300 | |
| Files | 0ae3da15ad5e71101b6a756e2d78fffc5249dde1 /src | |
| FMI-OOP-P2_Tables-5b8613c8634e2ed9f02d36582ea5bb588955cd95.tar FMI-OOP-P2_Tables-5b8613c8634e2ed9f02d36582ea5bb588955cd95.tar.gz FMI-OOP-P2_Tables-5b8613c8634e2ed9f02d36582ea5bb588955cd95.zip | ||
| Parent | 99a05dd4bed3c7027005048dca22b3a0efea5a90 (diff) | |
Autocommit at 30.05.2022 @ 21:38
1 files changed, 3 insertions, 4 deletions
| -rw-r--r-- | src/Models/Table.cpp | 7 |
diff --git a/src/Models/Table.cpp b/src/Models/Table.cpp index 861e2f0..9ef5884 100644 --- a/src/Models/Table.cpp +++ b/src/Models/Table.cpp @@ -61,7 +61,7 @@ void Table::readFromFile(std::ifstream& inFile) { if (inFile.peek() == '-') whole *= -1; } - if (isDigit(inFile.peek())) + if (!isDigit(inFile.peek())) throw std::logic_error(fileLocationExceptionMsg("Error: Expected digit but got something else at row ", cells.get_count(), inFile.tellg() % commaCount + 1)); // Parsing digits of whole number/whole part of floating point number @@ -69,10 +69,10 @@ void Table::readFromFile(std::ifstream& inFile) { (whole *= 10) += inFile.get() - '0'; } // Parsing digits of potential floating point number - if (inFile.peek() != '.') { + if (inFile.peek() == '.') { inFile.get(); while (isDigit(inFile.peek())) { - inFile.get(); + (whole *= 10) += inFile.get() - '0'; exponent *= 10; } } @@ -110,7 +110,6 @@ Table::Table(const char* filePath) { std::ifstream inFile(filePath); if (!inFile.is_open()) throw std::logic_error("Could not open file!"); - std::cout << inFile.peek() << std::endl; cells = List<List<Cell*>>(); readFromFile(inFile); inFile.close(); |
