-
Notifications
You must be signed in to change notification settings - Fork 0
/
BigInteger.h
27 lines (24 loc) · 985 Bytes
/
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
using namespace std;
class BigInteger{
private:
char sign;
int length;
//here the upper bound of length is 100 digits.
int value[100];
public:
void setNumber(string s);
string getNumber() const;
//friend BigInteger add(const BigInteger & a, const BigInteger & b);
friend BigInteger operator+(const BigInteger & a, const BigInteger & b);
friend istream & operator>>(istream & cin, BigInteger & a);
friend ostream & operator<<(ostream & cout, const BigInteger & a);
//this is prefix increament
friend BigInteger & operator++(BigInteger & a);
//this is postfix increment, the second parameter is just for distinguishment.
friend BigInteger operator++(BigInteger & a, int usless);
};
BigInteger operator+(const BigInteger & a, const BigInteger & b);
istream & operator>>(istream & cin, BigInteger & a);
ostream & operator<<(ostream & cout, const BigInteger & a);
BigInteger & operator++(BigInteger & a);
BigInteger operator++(BigInteger & a, int usless);