Question: in C++, please solve it step by step. thank you 1. Write the default constructor. It should simply fill in the array with 0s. Call

in C++, please solve it step by step. thank you
1. Write the default constructor. It should simply fill in the array with 0s. Call it from main (though you wont be able to see whether it was created correctly).
2. Explain how you plan to write the constructor that takes in a string. How can you convert the character 5 to the number 5? Recall your character arithmetic.
3. Write the constructor that takes in a string. Be sure to fill all the extra spots with 0. Call it from main (though you wont be able to see whether it was created correctly).
4. Overload the [] operator to return the ith digit in the biguint (use the array indexing; so if they do [0] you will give the digit in the ones place). What should your function return if the value in a is 1472 and a[900] is called? Call [] from main; use it to see whether the constructors worked.
5. Overload
6. Explain how you plan to overload +=. Think about how you learned to add in elementary school.
7. Overload += as a member function. Call it from main.
Start from the header file you can find here:
#ifndef BIGUINT_H
#define BIGUINT_H
#include
#include
#include
// WANT: integers with CAPACITY digits, only non-negative
//
// support:
// 2 constructors: int, string
// member functions: [] returns individual digits given position
// +=
// -=
// compare: return +1, 0, -1, depending on
// whether this biguint >, ==,
// +, - (binary), - (unary), =, >
// >
class biguint
{
public:
// CONSTANTS & TYPES
static const std::size_t CAPACITY = 20;
// CONSTRUCTORS
// pre: none
// post: creates a biguint with value 0
biguint();
// pre: s contains only decimal digits
// post: creates a biguint whose value corresponds to given string of digits
biguint(const std::string &);
// CONSTANT MEMBER FUNCTIONS
// pre: pos
// post: returns the digit at position pos
// 0 is the least significant (units) position
unsigned short operator [](std::size_t pos) const;
// pre: none
// post: returns 1 if this biguint > b
// 0 if this biguint == b
// -1 if this biguint
int compare(const biguint & b) const;
// MODIFICATION MEMBER FUNCTIONS
// pre: none
// post: b is added to this biguint; ignore last carry bit if any
void operator += (const biguint & b);
void operator -= (const biguint & b);
private:
unsigned short data_[CAPACITY];
// INVARIANTS:
// data_[i] holds the i^th digit of this biguint or 0 if not used
// data_[0] holds the least significant (units) digit
};
// nonmember functions
std::ostream& operator
biguint operator + (const biguint &, const biguint &);
biguint operator - (const biguint &, const biguint &);
bool operator
bool operator
bool operator != (const biguint &, const biguint &);
bool operator == (const biguint &, const biguint &);
bool operator >= (const biguint &, const biguint &);
bool operator > (const biguint &, const biguint &);
#endif // BIGUINT_H
in C++, please solve it step by step. thank you 1. Write
in c++ please

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!