I need help with this program. So i\'m stuck at the ++ operator overload. What w
ID: 3679514 • Letter: I
Question
I need help with this program. So i'm stuck at the ++ operator overload. What would be the general strategy for creating that function? I've tried to use a for loop to go through the digits array and modify each digit. That part of the code works. What I'm confused about is how to know how many digits to check. I created a for loop that keeps track of how many using a "counter" int, but it doesn't seem to work. It just ends up having no value when i cout to check.
Also, how would I do the ++(int) where I return the unmodified object before modifying? Does that involve making another object within the function? I'm a bit confused on the process here.
Lastly, for the > operator, that's just checking if the number stored is larger than the other number, correct? Thanks!
HugeInt const int SIZE = 50; digits[SIZE] : int - - length: int + HugeInt::HugeInt) Effect: creates a HugeInt object which stores the value 5555 Postcondition: this object is ready for any computations Digits from 5555 are stored in the array + HugeInt::HugeInt(string value) Effect: creates a HugeInt object which stores 'value Postcondition: this object is ready for any computations Digits from value are stored in the array +int HugeInt::numDigits) const Effect: returns the number of digits in this HugeInt Postcondition: this HugeInt object is unchanged + int HugeInt::operator[l(int n) Effect: returns the nth digit in this HugeInt object Postcondition: this HugeInt object is unchanged If n is not the index of a digit, then -1 is returned + HugeInt HugeInt::operator++O Effect: preincrement operator for this HugeInt object Postcondition: increases digits in this int byl, digit of 9 increments to 0 Returns: new Hugelnt object in which digits are same as calling object after increment + HugeInt HugeInt::operator++(int) Effect: postincrement operator for this HugeInt object Postcondtion: increases digits in this int byl, digit of 9 increments to 0 Returns: new Hugelnt object in which digits are the same as calling object before increment + bool HugeInt::operator>(const HugeInt& operand) const Effect: determines if the implied HugeInt object is greater than the operand returning true or false Postcondition: the two HugeInt operands are unchanged + static bool HugeInt::allDigits(string str) This function returns true if the parameter 'str contains only digits, and false otherwise friend ostream& operatorExplanation / Answer
For the big integer problems kin C++ use below header file
the recipient then recovers the original message M as the natural number less than
N that is congruent to M^ED (mod N)
HugeInt::HugeInt(int x){
int i =0;
while(x > 0){
digits[i++] = x % 10;
x = x/10;
}
for(;i< CAPACITY;i++){
digits[i]=0;
}
}
use the aboev snippet in your code that will help you getthe required output.