Ejemplo n.º 1
0
        //set value at this digit
        public void setDigit(Digit d, int index)
        {
            if (index >= 1)//make sure index is in range
            {
                Digit atIndex = new Digit();
                setDigitsList(index);//make sure Digits list is long enough
                if (dig >= index)
                {
                    atIndex.set(num, index);

                    if (atIndex.Value != 0)//if digit at index is not 0
                        removeDigit(index);//then set to 0
                }
                num += (digits[index - 1]) * d.Value;//add digit to num at specified index
            }
        }