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 15:10
What role did women fill during world war ii?
Answers: 1
question
Computers and Technology, 24.06.2019 18:20
The following if statement contains a logic error, not a syntax error. rewrite it so that it is correct. assume the variable age already exists and holds a valid number. if (age == 18 & & age == 19) {
Answers: 1
question
Computers and Technology, 25.06.2019 10:20
Write a program that lets the user play the game of rock, paper, scissors against the computer. the program should work as follows. 1. when the program begins, a random number in the range of 1 through 3 is generated. if the number is 1, then the computer has chosen rock. if the number is 2, then the computer has chosen paper. if the number is 3, then the computer has chosen scissors. (don’t display the computer’s choice yet.) 2. the user enters his or her choice of “rock”, “paper”, or “scissors” at the keyboard. (you can use a menu if you prefer.) 3. the computer’s choice is displayed. 4. a winner is selected according to the following rules: • if one player chooses rock and the other player chooses scissors, then rock wins. (the rock breaks the scissors.) • if one player chooses scissors and the other player chooses paper, then scissors wins. (scissors cuts paper.) • if one player chooses paper and the other player chooses rock, then paper wins. (paper wraps rock.) • if both players make the same choice, the game must be played again to determine the winner. be sure to divide the program into functions that perform each major task. include the code and the console output from running your program with test inputs in your report.
Answers: 3
question
Computers and Technology, 25.06.2019 10:40
If you're using the paintbrush tool and want to change the color of the paint being used what should you change
Answers: 2
You know the right answer?
Create the class BigInt and overload the following operators: +

-

*
Questions
question
History, 05.03.2021 23:20
question
English, 05.03.2021 23:20
question
Mathematics, 05.03.2021 23:20
question
Mathematics, 05.03.2021 23:20
question
Mathematics, 05.03.2021 23:20
question
Mathematics, 05.03.2021 23:20
Questions on the website: 13722360