Computers and Technology

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;

}

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 05:30, xbeatdroperzx
Gerard is currently working as an entry-level customer support technician, but he would like to someday become a software developer. what is the best first step to understand what he should do? ask his manager for a new job or at least a job recommendation study graphic design in order to obtain the necessary skills use career resources to investigate what skills and education are required work part-time as an entry-level web developer question 13 (true/false worth 6 points) (08.03 lc) career resources are used to explore career options and find career information. true false question 14(multiple choice worth 6 points) (08.01 mc) classify the following skills: writing html code, evaluating color theory, using design principles. hard skills interpersonal skills people skills soft skills question 15 (true/false worth 6 points) (08.03 lc) a mentor is a person who is advised, trained, or counseled by a trusted mentee. true false
Answers: 2
image
Computers and Technology, 22.06.2019 23:30, Molly666
What does 21 pilots middle aged name as a band 15 years prior to them naming their band 21 pilots?
Answers: 1
image
Computers and Technology, 23.06.2019 02:00, mayapril813
Consider the following function main: int main() { int alpha[20]; int beta[20]; int matrix[10][4]; . . } a. write the definition of the function inputarray that prompts the user to input 20 numbers and stores the numbers into alpha. b. write the definition of the function doublearray that initializes the elements of beta to two times the corresponding elements in alpha. make sure that you prevent the function from modifying the elements of alpha. c. write the definition of the function copyalphabeta that stores alpha into the first five rows of matrix and beta into the last five rows of matrix. make sure that you prevent the function from modifying the elements of alpha and beta. d. write the definition of the function printarray that prints any onedimensional array of type int. print 15 elements per line. e. write a c11 program that tests the function main and the functions discussed in parts a through d. (add additional functions, such as printing a two-dimensional array, as needed.)
Answers: 3
image
Computers and Technology, 23.06.2019 03:50, nakeytrag
Iam a bacterium. i cause stomach cramps and diarrhea. i am caused by eating rotten foodssuch as chicken, fish, or eggs. sometimes turtles carry my bacteria. what am i?
Answers: 2
Do you know the correct answer?
Create the class BigInt and overload the following operators: +

-

*

Questions in other subjects: