Ejemplo n.º 1
0
 public static BigInt operator +(BigInt b1, BigInt b2)
 {
     BigInt b3= new BigInt("");
     int i, sledrazryad=0;
     for(i=0; i<=19; i++)
     {
         b3.Inum[19 - i] = b2.Inum[19 - i] + b1.Inum[19 - i]+sledrazryad;
         sledrazryad = 0;
         if (b3.Inum[19-i]>=10)
         {
             sledrazryad = 1;
             b3.Inum[19 - i] -= 10;
         }
     }
     int ik = 0;
     for (ik = 0; ik < 19; ik++)
     {
         if (b3.Inum[ik] != 0)
             break;
     }
     for (ik = ik; ik <= 19; ik++)
     {
         b3.BIname = b3.BIname + b3.Inum[ik];
     }
     return b3;
 }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            /*
             System.Text.StringBuilder sb = new System.Text.StringBuilder();
             for (int i = 0; i < 10; i++)
             {
                sb.Append(i.ToString());
             }
             System.Console.WriteLine(sb); 
             sb[0] = sb[9];
             System.Console.WriteLine(sb);  
            */


            /*
            System.Text.StringBuilder sb = new System.Text.StringBuilder("Rat: the ideal pet");
            sb[0] = 'C';
            System.Console.WriteLine(sb.ToString());
            System.Console.ReadLine();
            */

            /*
            string str = "hello";
            string nullStr = null;
            string emptyStr = String.Empty;
            string tempStr = str + nullStr;
            Console.WriteLine(tempStr);
            bool b = (emptyStr == nullStr);
            Console.WriteLine(b);
            string newStr = emptyStr + nullStr;
            Console.WriteLine(emptyStr.Length);
            Console.WriteLine(newStr.Length);
            string s1 = "\x0" + "abc";
            string s2 = "abc" + "\x0";
            Console.WriteLine("*" + s1 + "*");
            Console.WriteLine("*" + s2 + "*");
            Console.WriteLine(s2.Length);
            */

            /*
            string question = "hOW DOES mICROSOFT wORD DEAL WITH THE cAPS lOCK KEY?";
            System.Text.StringBuilder sb = new System.Text.StringBuilder(question);

            for (int j = 0; j < sb.Length; j++)
            {
               if (System.Char.IsLower(sb[j]) == true)
               sb[j] = System.Char.ToUpper(sb[j]);
               else if (System.Char.IsUpper(sb[j]) == true)
               sb[j] = System.Char.ToLower(sb[j]);
            }
            string corrected = sb.ToString();
            System.Console.WriteLine(corrected);
            */

            /*
            string s5 = "Printing backwards";
            for (int i = 0; i < s5.Length; i++)
            {
               System.Console.Write(s5[s5.Length - i - 1]);
            }
            */

            /*
            string s3 = "Visual C# Express";
            System.Console.WriteLine(s3.Substring(7, 2));
            System.Console.WriteLine(s3.Replace("C#", "Basic"));
            int index = s3.IndexOf("C");
            */

            /*
            System.Console.WriteLine("Enter a number");
            string input = System.Console.ReadLine();

            int j;
            System.Int32.TryParse(input, out j);

            string s;
            for (int i = 0; i < 10; i++)
            {
                s = System.String.Format("{0} times {1} = {2}", i, j, (i * j));
                System.Console.WriteLine(s);
            }

            System.Console.ReadKey();
             */



            /*
            string columns = "Column 1\tColumn 2\tColumn 3";
            string rows = "Row 1\r\nRow 2\r\nRow 3";
            */

           

            /*
            string s1 = "Hello ";
            string s2 = s1;
            s1 += "World";
            System.Console.WriteLine(s2);
            */


            /*
            string s1 = "A string is more ";
            string s2 = "than the sum of its chars.";
            s1 += s2;
            System.Console.WriteLine(s1);
            */


            /*
            string message1;
            string message2 = null;
            string message3 = System.String.Empty;
            string oldPath = "c:\\Program Files\\Microsoft Visual Studio 8.0";
            string newPath = @"c:\Program Files\Microsoft Visual Studio 9.0";
            System.String greeting = "Hello World!";
            var temp = "I'm still a strongly-typed System.String!";
            const string message4 = "You can't get rid of me!";
            char[] letters = { 'A', 'B', 'C' };
            string alphabet = new string(letters);
            */


            /*
             int[] array1 = new int[5];       
             int[] array2 = new int[] { 1, 3, 5, 7, 9 };
             int[] array3 = { 1, 2, 3, 4, 5, 6 };
             int[,] multiDimensionalArray1 = new int[2, 3];
             int[,] multiDimensionalArray2 = { { 1, 2, 3 }, { 4, 5, 6 } };
             int[][] jaggedArray = new int[6][];
             jaggedArray[0] = new int[4] { 1, 2, 3, 4 };
            */


            /*
            string s = "The answer is " + 5.ToString();
            Console.WriteLine(s);
            Type type = 12345.GetType();
            Console.WriteLine(type);
            */


            /*
            int[] nums = { 1, 2, 3, 4, 5 };
            int len = nums.Length;
            */


            /*
            public enum FileMode
            {
                CreateNew = 1,
                Create = 2,
                Open = 3,
                OpenOrCreate = 4,
                Truncate = 5,
                Append = 6,
            }
            */

            /*
            public struct CoOrds
            {
               public int x, y;

               public CoOrds(int p1, int p2)
               {
                   x = p1;
                   y = p2;
               }
            }
            */


            /*
            public string GetName(int ID)
            {
              if (ID < names.Length)
              return names[ID];
              else
              return String.Empty;
            }
            private string[] names = { "Spencer", "Sally", "Doug" };
            */


            /*
            float temperature;
            string name;
            MyClass myClass;
            char firstLetter = 'C';
            var limit = 3;
            int[] source = { 0, 1, 2, 3, 4, 5 };
            var query = from item in source
            where item <= limit
            select item;
            */


            /*
            int a = 5;             
            int b = a + 2;
            bool test = true;
            int c = a + test;
            */


            /*
            Console.WriteLine("Hello World!");
            Console.WriteLine("Press any key to exit.");
            Console.ReadKey();
            */


           
            Console.WriteLine("Write Bigint ba");
            BigInt ba = new BigInt (Console.ReadLine());
            Console.WriteLine(ba);
            Console.WriteLine("Write Bigint bb");
            BigInt bb = new BigInt(Console.ReadLine());
            BigInt bc = bb + ba;
            Console.WriteLine(bc);
            Console.ReadKey();
           


            /* Student w = new Student("Aril", "Bekpaev", 18, "16BD2001", 4.0);
             Console.WriteLine(w);
             Console.ReadKey();*/


            /*Console.WriteLine("Write complex number a");
            Complex a = new Complex(int.Parse(Console.ReadLine()), int.Parse(Console.ReadLine()));
            Console.WriteLine("Write complex number b");
            Complex b = new Complex(int.Parse(Console.ReadLine()), int.Parse(Console.ReadLine()));
            Complex c;
            c = a + b;
            Console.WriteLine("a+b= "+c);
            Console.ReadKey();*/



            /* Console.WriteLine("Write numbers that you want to check");
             string prime = Console.ReadLine();
             string[] prime1 = prime.Split();
             foreach(string num in prime1)
             {
                 int pri = int.Parse(num);
                 int i, k=1;
                 for(i=2; (i<pri)&&(pri!=1)&&(pri!=2)&&(k!=0); i++)
                 {
                     k = pri % i;
                 }
                 if ((k!=0)&&(pri!=0))
                 {
                     Console.Write("{0} ", pri);
                 }
             }
             Console.ReadKey();*/
        }