The native int type in C++ cannot store large integers of more than 10 decimal digits. In this project, you will implement a bigint class that behaves like the int type but can handle unsigned integers of up to 45 digits. 1. You are to build a class named bigint that can deal with up to 45 decimal digits of unsigned integers. The bigint class is specified as follows. 2. The bigint class should have a five-element array (int v[5];) as its private date member. Each element should store 9 decimal digits. For example to store integer 1,300,000,000,000,900,000,000,100,000,000. You should have v[0] = 100000000, v[1] = 900000000, v[2] =0, v[3]= 1300, and v[4] = 0. 3. The bigint class should have the following constructors: bigint(); // default constructor, set the value to be 0 bigint(int x0); // set the value to be x0 bigint(int x0, int x1); // set the value to be x1 ∗ 109 + x0 bigint(int x0, int x1, int x2); // set the value to be x2 ∗ 1018 + x1 ∗ 109 + x0 bigint(int x0, int x1, int x2, int x3); bigint(int x0, int x1, int x2, int x3, int x4); 4. To make bigint behave like int, you must overload the following operators • The extraction operator » for reading a bigint number from an input stream. The input number can have up to 45 digits. Following are two legitimate bigint numbers that can appear as input: 1300000000000900000000100000000 9999999999999999999999999999999999999999999 • The insertion operation « for output a bigint number to an output stream. The number must be output like a regular int number with the first digit being a non zero. • 2 arithmetic operators + and – (*, and / are omitted for this type to simplify the program). • 6 comparison operators <, >, <=, >=, ==, and !=. 5. Once the class is implemented, you can test your implementation using the driver.cpp program. You should also write other driver programs to do a thorough test of your bigint implementation. Put your bigint class declaration in bigint.h and your bigint class implementation in bigint.cpp. Redirect test.txt as the standard input, the output of the program should be identical to ouputt.txt.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%

The native int type in C++ cannot store large integers of more than 10 decimal digits. In this project, you will implement a bigint class that behaves like the int type but can handle unsigned integers of up to 45 digits.


1. You are to build a class named bigint that can deal with up to 45 decimal digits of unsigned integers. The
bigint class is specified as follows.


2. The bigint class should have a five-element array (int v[5];) as its private date member. Each element
should store 9 decimal digits.
For example to store integer 1,300,000,000,000,900,000,000,100,000,000. You should have v[0] = 100000000,
v[1] = 900000000, v[2] =0, v[3]= 1300, and v[4] = 0.


3. The bigint class should have the following constructors:
bigint(); // default constructor, set the value to be 0
bigint(int x0); // set the value to be x0
bigint(int x0, int x1); // set the value to be x1 ∗ 109 + x0
bigint(int x0, int x1, int x2); // set the value to be x2 ∗ 1018 + x1 ∗ 109 + x0
bigint(int x0, int x1, int x2, int x3);
bigint(int x0, int x1, int x2, int x3, int x4);

4.

To make bigint behave like int, you must overload the following operators
• The extraction operator » for reading a bigint number from an input stream. The input number can
have up to 45 digits. Following are two legitimate bigint numbers that can appear as input:
1300000000000900000000100000000
9999999999999999999999999999999999999999999
• The insertion operation « for output a bigint number to an output stream. The number must be
output like a regular int number with the first digit being a non zero.
• 2 arithmetic operators + and – (*, and / are omitted for this type to simplify the program).
• 6 comparison operators <, >, <=, >=, ==, and !=.


5. Once the class is implemented, you can test your implementation using the driver.cpp program. You should
also write other driver programs to do a thorough test of your bigint implementation. Put your bigint class
declaration in bigint.h and your bigint class implementation in bigint.cpp. Redirect test.txt as the standard
input, the output of the program should be identical to ouputt.txt.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY