added init constructor

This commit is contained in:
Andrei Yankovich 2019-07-13 17:49:15 +03:00
parent 814d7a0247
commit 157fe48a55
2 changed files with 5 additions and 0 deletions

View File

@ -34,6 +34,10 @@ BigInt::BigInt(long val):
mpz_set_si(data, val);
}
BigInt::BigInt(char item, unsigned int size, int base = 2):
BigInt(std::string(size, item),base) {
}
std::string BigInt::getString(int base) const {
char *str = mpz_get_str(nullptr, base, data);
return str;

View File

@ -26,6 +26,7 @@ public:
BigInt(const std::string &imput, int base = 10);
// BigInt(const char * str, int base = 10);
BigInt(long val);
BigInt(char item, unsigned int size, int base);
std::string getString(int base = 10) const;
~BigInt();