subject

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 = "<< A< B? : " <<(A>B)< =D? : " <<(A>=D)<
cout<<"Is C<=D? : " <<(C<=D)<
cout<<"Post Increment A by 1: " <
cout<<"Post Decrement A by 1: " <
cout<<"Pre Increment A by 1: " <<++A<
cout<<"Pre Decrement A by 1: " <<--A<
cout<<"What is ! of (A-D)? "<

return 0;

}

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 19:00
Now you’re on your own. include a short summary of this section with plots in your lab report. write a matlab script file to do steps (a) through (d) below. include a listing of the script file with your report. 1 the soundsc(xx,fs) function requires two arguments: the first one (xx) contains the vector of data to be played, the second argument (fs) is the sampling rate for playing the samples. in addition, soundsc(xx,fs) does automatic scaling and then calls sound(xx,fs) to actually play the signal. mcclellan, schafer, and yoder, dsp first, 2e, isbn 0-13-065562-7. prentice hall, upper saddle river, nj 07458. c 2015 pearson education, inc. 4 mcclellan, schafer and yoder, signal processing first. prentice hall, upper saddle river, new jersey, 2003. c 2003 prentice hall. (a) generate a time vector (tt) to cover a range of t that will exhibit approximately two cycles of the 4000 hz sinusoids defined in the next part, part (b). use a definition for tt similar to part 2.2(d). if we use t to denote the period of the sinusoids, define the starting time of the vector tt to be equal to t , and the ending time as ct . then the two cycles will include t d 0. finally, make sure that you have at least 25 samples per period of the sinusoidal wave. in other words, when you use the colon operator to define the time vector, make the increment small enough to generate 25 samples per period. (b) generate two 4000 hz sinusoids with arbitrary amplitude and time-shift. x1.t / d a1 cos.2
Answers: 1
question
Computers and Technology, 24.06.2019 00:00
Visualizing a game of “tag” to remember the meaning of contagious
Answers: 3
question
Computers and Technology, 24.06.2019 20:30
Where is permanent data in the computer stored whenever gym starts his laptop he sees some commands in numbers appearing on the screen these instructions are being preceded by the control unit in
Answers: 1
question
Computers and Technology, 25.06.2019 08:20
E-commerce builds on traditional commerce by adding the flexibility that networks offer and the availability of the internet. - true or false
Answers: 1
You know the right answer?
Create the class BigInt and overload the following operators: +

-

*
Questions
question
Arts, 28.02.2021 14:00
question
Geography, 28.02.2021 14:00
question
Mathematics, 28.02.2021 14:00
Questions on the website: 13722361