-
Notifications
You must be signed in to change notification settings - Fork 1
/
Number.h
59 lines (51 loc) · 1.55 KB
/
Number.h
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#pragma once
// Dependencies | std
#include <string>
class Number {
// Static
public:
// Properties
static const int MAX_DIGIT_COUNT;
static const int MAX_WHOLE_DIGIT_COUNT;
static const int MAX_DECIMAL_DIGIT_COUNT;
// Object
private:
// Properties
long long value;
std::string text;
public:
// Constructor / Destructor
Number();
Number(long long value);
Number(const std::string& text);
~Number();
// Getters
long long getValue() const;
std::string getText() const;
// Setters
bool setValue(long long value);
bool setValue(const std::string& string);
// Functions
std::string to_string() const;
// Operators
Number operator+(const Number& other) const;
Number operator-(const Number& other) const;
Number operator*(const Number& other) const;
Number operator/(const Number& other) const;
Number& operator+=(const Number& other);
Number& operator-=(const Number& other);
Number& operator*=(const Number& other);
Number& operator/=(const Number& other);
Number& operator=(const Number& other);
bool operator==(const Number& other) const;
bool operator<(const Number& other) const;
bool operator>(const Number& other) const;
bool operator<=(const Number& other) const;
bool operator>=(const Number& other) const;
bool operator!=(const Number& other) const;
};
// Notes
/*
* long long range: [-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807]
* long long range as decimal: [92,233,720,368.54775807,
*/