Lab Test 3

 

Use the HugeInteger definition in Assignment 3 to do the following problems:

1.         Write a function void HI_output(const HugeInteger &i) to print a HugeInteger i on the screen.

2.         Write a function void HI_set(HugeInteger &i, char* p) to set a HugeInteger i to be the value represented by a string p.

3.         Write a function void add_positiveHI(const HugeInteger &x, const HugeInteger &y, HugeInteger& z) to add two non-negative HugeIntegers x and y. Don’t change z if either x or y is negative.

4.         Write a function int HI_lessthan(const HugeInteger &x, const HugeInteger &y) to determine if x is less than y. It should return 1 if x < y and return 0 otherwise. Note that x and y may be positive or negative.

5.         Write a function void HI_multiply(const HugeInteger &x, const HugeInteger &y, HugeInteger &z) to compute z = x * y. Note that x and y may be positive or negative.

 

Copy this program template as your starting point. Do not change the main program; write the five functions only.