Create the class BigInt and overload the following operators:+ - * ! == >= > ++ (pre/post) -- (pre/post) >> Question:Support a constructor that creates the big int given a vector of digits (int or...


Create the class BigInt and overload the following operators:+
-
*
!
==
>=
>




++ (pre/post)
-- (pre/post)


>>
Question:Support a constructor that creates the big int given a vector of digits (int or char), a C array of characters and a size. The idea is to create class that can take any size of integer by keeping the individual digits in a a vector
1) if two numbers are given like A={20}, B={220,}, A+B Should be {240}
2)for >> operator the function should take the whole integer as ascii string
create class to represent large integers
3) the result of any operation should lead to another valid bigint not to an invalid vector
4)For ! operator:
!0 = true
!1 = false
!19999999999 = false
So no, this does not make negative numbers positive, it is true only if argument is zero
5)
- BigInt is a class where we represent big integers using "vector "?----->the integer 12345 is represented as vector={1, 2, 3, 4, 5}
6)The char given must be an ASCII digit (exception negative sign). This should be a precondition in THE code and must be verified and error must be conveyed to the user.
7)For negative numbers, the input C char array (char[]) will have something like this {'-', '1', '2'}
8)So the class is not the one accepting input but constructors of the class.notice that it needs 3 types of special constructors: one that takes a vector of int digits, one that takes a vector of char digits and one that takes a C array of characters and the size.
You must support negative numbers: on a char array it is trivial how to do it: '-' must appear before a negative number, when using a vector with integers you can use negative integer to represent the sign at the start of the big int.
Please do it in c++ and also maintain 3 files.. BigInt.h,BigInt.cc(implementation) and main.cc( this contains main function)
main.cc is given below. Do not attempt to make any changes in main.cc .Check if the code is working for all the scenarios in main.cc. All that you need to implement is ,BigInt.cc(implementation file) and BigInt.h(header file)
main.cc:
#include "BigInt.h" /* Your own header file */
#include
#include
using namespace std;
int main(int argc, const char * argv[]){
vector integerVector;
integerVector.push_back(2);
integerVector.push_back(1);
integerVector.push_back(0);
vector charVector;
charVector.push_back('2');
charVector.push_back('1');
char charArray[] = {'1', '0'};
BigInt A = BigInt(integerVector);
cout<"a ==""><>< b?="" :="" "=""><(a>B)< =d?="" :="" "=""><(a>=D)
cout
cout
cout
cout
cout
cout
return 0;
}

Apr 05, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here