-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBigInteger.h
38 lines (30 loc) · 1.09 KB
/
BigInteger.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
#include <iostream>
#include <cstring>
#include <array>
class BigInteger
{
public:
enum class Sign
{
MINUS,
PLUS
};
private:
static constexpr size_t DIM_MAX = 1000;
static constexpr int8_t BASE_TEN = 10;
Sign sign {Sign::PLUS};
uint16_t number_of_digits {0};
std::array<int8_t, DIM_MAX> digits {};
auto operator==(BigInteger const & big_integer) const noexcept -> bool;
auto operator<(BigInteger const & big_integer) const noexcept -> bool;
auto operator>(BigInteger const & big_integer) const noexcept -> bool;
auto operator>=(BigInteger const & big_integer) const noexcept -> bool;
public:
BigInteger(Sign const & new_sign, uint16_t new_nod, std::string_view new_digits) noexcept;
BigInteger() noexcept;
friend auto operator<<(std::ostream & stream, BigInteger const & big_integer) noexcept -> std::ostream &;
auto operator+(BigInteger) noexcept -> BigInteger;
auto operator-(BigInteger) noexcept -> BigInteger;
auto operator*(BigInteger) noexcept -> BigInteger;
auto operator/(BigInteger) -> BigInteger;
};