Question
#ifndef BIGUINT_H #define BIGUINT_H #include using namespace std; class BigUInt { private: unsigned char* data; int length; public: BigUInt(); // Initialize to zero objects //
#ifndef BIGUINT_H #define BIGUINT_H
#include
private: unsigned char* data; int length;
public: BigUInt(); // Initialize to zero objects // 2. (5 points) Initializes the BigUInt to n. // Allocate data to an array the number of digits. BigUInt(unsigned int n); // 3. (1 point) Frees space in data. ~BigUInt(); // 4. (1 point) Print the number represented by this BigUInt. void Print(); // 5. (4 points) Set this BigUInt to original value times 10^p. // Allocate space as neccessary. void TimesTenPow(unsigned int p); // 6. (6 points) Set this BigUInt to original value plus rhs. // Allocate space as necessary. BigUInt& operator+=(const BigUInt& rhs); // 7. (2 points) Print the number represented by this BigUInt. friend ostream& operator<<(ostream& os, const BigUInt& b);
}; ostream& operator<<(ostream& os, const BigUInt& b);
#endif // BIGUINT_H
#include
int main() { BigUInt b1(88408721); BigUInt b2(69606478);
b1.Print(); b2.Print();
b1 += b2; b1.Print();
b1.TimesTenPow(15); b1.Print();
/*b1 += b2; b1.Print();
cout << b1; */ return 0; } /* Results: 88408721 158015199 158015199000000000000000 158015199000000069606478 158015199000000069606478 */
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started