BigIntenger

Task 1 . Implement two constructors to initialize a BigInteger object from an int value (4 points) or a string storing an integer value (4 points). Hint: You can use method setDigit

Task 2 . Overload operator + for adding two BigInteger objects. You can do this similar to function multiply, which multiplies a BigInteger x to an int value y and shift the result p digits to the right, i.e. it computes x*y*10^px*y*10p.

Task 3 . Overload operator * for multiplying two BigInteger objects. You can use function multiply as a helper function. That is, if y0, y1…, yn is the digits of y, y = \sum^n_{i=0}{y_i*10^i}y=∑i=0nyi*10i thus x*y = \sum^n_{i=0}{x*y_i*10^i}x*y=∑i=0nx*yi*10i.

Task 4 In main.cpp, complete the code to compute the 1000th Fibonacci number. The Fibonacci sequence is defined as the following rules: Fibo[0] = 1, Fibo[1] = 1, Fibo[n] = Fibo[n-1] + Fibo[n-2].

Task 5 . Overload operators == (2 points), != (1 point), < (2 points), and > (1 point) for comparing two BigInteger objects. Note that != can be defined via == and > is defined via <.

Task 6 . In main.cpp, compute 2^1000, 2^1001, and 2^2001 and verify your comparison operators using the following tests:

2^1000 < 2^1001

2^1000 * 2^1001 == 2^2001

TAKE ADVANTAGE OF OUR PROMOTIONAL DISCOUNT DISPLAYED ON THE WEBSITE AND GET A DISCOUNT FOR YOUR PAPER NOW!

© 2020 customphdthesis.com. All Rights Reserved. | Disclaimer: for assistance purposes only. These custom papers should be used with proper reference.