Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C++ an unsigned int data type can save 4 bytes. If all four bytes are being used for its value (i.e. this is

 

Note: Your program should only allow user to save single digit value on each location of array. i.e. any array location can hNote: Make all variables private. Make all functions public. Make separate setter and getter functions for each variable.  
 

In C++ an unsigned int data type can save 4 bytes. If all four bytes are being used for its value (i.e. this is an unsigned integer) then you have 8 * 4 = 32 bits, so your range is from 0 to 2^32 (0 - 4,294,967,295). If we conclude the above statement, the maximum range for storing an unsigned int is 4,294,967,295 i.e. upto 10 digits. If any number larger than that is saved it will result in truncation. Create a class hugeInteger that uses a N-element array of digits to store integers as large as Ndigits. Make sure to make header and cpp files. Choose appropriate properties. Provide member functions: Implement header file Default and Parameterized constructor Copy Constructor(shallow copy) Destructor Input (take 20 values for 20 array locations from user. Each location can only contain 0-9 ) Output (cout the whole array i.e. 20 digit integer) Add ( to add a hugeInteger type variable provided as an input and returns the sum as another huge Integer) isZero (return 1 if the number is zero, return 0 if number is non-zero) input [10,10,2,3,4,0,1] isEqualTo (compare two hugeIntegers) isGreater Than (compare two huge Integers) o Above two function takes one huge integer type variable as an argument and returns true if the condition is satisfied and false otherwise = Note: Your program should only allow user to save single digit value on each location of array. i.e. any array location can hold value (0-9). For example I want to save an int value 34178994301116789033. This value cannot be saved in unsigned int data type. For this your huge Integer struct can be used. Each hugeInt class can save a hugeInt of length 20. Consider the following example void main() { huge Integer i(20); } i.setvalue(); // prompts the user to enter 20 digit number [0] [1] [2] 3 4 | 1 [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] 1 6 7 8 9 0 3 3 7 8 9 9 4 3 0 11 Hugelnt type variable i containing array of size 20 Note: Make all variables private. Make all functions public. Make separate setter and getter functions for each variable.

Step by Step Solution

3.34 Rating (157 Votes )

There are 3 Steps involved in it

Step: 1

Here is the output of the code The value of i 1... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Essential Statistics In Business And Economics

Authors: David Doane, Lori Seward

3rd Edition

1260239500, 978-1260239508

More Books

Students also viewed these Computer Engineering questions

Question

3. Explain what is meant by Monetizing the Debt.

Answered: 1 week ago

Question

Are the variables cross-sectional data or time-series data?

Answered: 1 week ago