Esempio n. 1
0
 public MyInt subTrack(MyInt b)
 {
     byte[] res = new byte[b.ToString().Length + 1];
     byte[] bb  = b.ToArr();
     for (int i = b.ToString().Length - 1; i >= 0; i--)
     {
         this.ToArr()[i] = Convert.ToByte(this.ToArr()[i] - bb[i]);
     }
     return(this);
 }
Esempio n. 2
0
        public MyInt add(MyInt b)
        {
            byte[] bb   = b.ToArr();
            int    size = this.ToArr().Count();

            if (bb.Count() > num.Count())
            {
                byte[] temp = bb;
                bb  = num;
                num = temp;
            }
            size = num.Count();
            //MyInt res=new MyInt();
            int redix = 10;
            int mem   = 0;
            int dif   = Math.Abs(bb.Count() - num.Count());

            for (int i = b.ToString().Length - 1; i >= 0; i--)
            {
                num[i] = Convert.ToByte(num[i] + bb[i] + mem);
                mem    = 0;
                if (num[i] >= redix)
                {
                    num[i] %= 10;
                    mem     = 1;
                }
            }
            return(this);
        }