blob: 2e6109967e46bbac1ba079a43eddd0f82ed45d10 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#include "CellInt.h"
#include <cstring>
CellInt::CellInt(int value) {
this->value = value;
}
#include <iostream>
CellInt::CellInt(const char* str) {
std::cout << "Int: " << str << std::endl;
value = 0;
bool negative = *str == '-';
if (*str == '-' || *str == '+') str++;
while (*str != '\0')
value = value * 10 + (*(str++) - '0');
if (negative) value *= -1;
}
double CellInt::getNumeralValue() const {
return value;
}
String CellInt::getValueForPrint() const {
return String() += value;
}
void CellInt::parseAndSetValue(const char* str) {
value = atoi(str);
}
void CellInt::writeToFile(std::ofstream& file) {
file << value;
}
|