Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Could you complete this without adding any header file? Please use the given hea

ID: 3592097 • Letter: C

Question

Could you complete this without adding any header file?

Please use the given header file only.

-------------------------------------------------------------------------------

You'll be working with big numbers. These numbers are too big to fit into an int type, or even into a long long! We'll be working with integers that are up to 100 digits in length. To store these, it will take a special class with some interesting methods. Here is an outline of the BigInt class you should use:

#include <iostream>

#include <string>

using namespace std;

class BigInt {

private:

int arr[100];

public:

BigInt() { }

// this constructor should convert str into an array of ints,

// storing the values on the RIGHT SIDE of the array :)

BigInt(string str) {

}

// this constructor should save the num array into arr verbatim

BigInt(int num[100]) {

}

// this function gets the digit at 'index' from arr

int get(int index) {

}

// this function should add the argument "num"

// to the private array and return the sum

BigInt add(BigInt num) {

}

// this function should subtract the argument "num"

// from the private array and return the difference

BigInt sub(BigInt num) {

}

// this function will print the BigInt with NO leading zeroes

void print() {

}

};

In main, please get input from the user in the form of two strings and use those strings to construct two BigInt's. You may assume that the first input is larger than the second (so that you don't have to worry about negative numbers from subtraction). Next, echo the numbers that you input, so that you know you did the input correctly. Then, output the sum and difference of these two numbers. You will need to use the other constructor and 'get' function along the way. This is more challenging than it may first appear.

Explanation / Answer

#include <iostream>

#include <string>

using namespace std;

class BigInt {

private:

int arr[100];

public:

BigInt() { }

// this constructor should convert str into an array of ints,

// storing the values on the RIGHT SIDE of the array :)

BigInt(string str) {

}

// this constructor should save the num array into arr verbatim

BigInt(int num[100]) {

}

// this function gets the digit at 'index' from arr

int get(int index) {

}

// this function should add the argument "num"

// to the private array and return the sum

BigInt add(BigInt num) {

}

// this function should subtract the argument "num"

// from the private array and return the difference

BigInt sub(BigInt num) {

}

// this function will print the BigInt with NO leading zeroes

void print() {

}

};

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote