Пример #1
0
        static void Main(string[] args)
        {
            Console.Write("a >>");
            NAry a = new NAry(Console.ReadLine());

            Console.Write("b >>");
            NAry b = (NAry)Console.ReadLine();

            Console.WriteLine($"a = {a.ToString()}({a.ToDouble()})");
            Console.WriteLine($"b = {b.ToString()}({b.ToDouble()})");
            Console.WriteLine();
            Console.WriteLine($"{a} + {b} = {a + b}({(a + b).ToDouble()})");
            Console.WriteLine($"{a} - {b} = {a - b}({(a - b).ToDouble()})");
            Console.WriteLine($"{a} * {b} = {a * b}({(a * b).ToDouble()})");
            Console.WriteLine($"{a} / {b} = {a / b}({(a / b).ToDouble()})");
            Console.WriteLine($"a  < b : {a < b}");
            Console.WriteLine($"a <= b : {a <= b}");
            Console.WriteLine($"a  > b : {a > b}");
            Console.WriteLine($"a >= b : {a >= b}");
            Console.WriteLine($"a == b : {a == b}");
            Console.WriteLine($"a != b : {a != b}");
            Console.WriteLine($"a++ : {a++}");
            Console.WriteLine($"++a : {++a}");
            Console.WriteLine($"b-- : {b--}");
            Console.WriteLine($"--b : {--b}");

            Console.WriteLine($"a(2) = {a = new NAry(a, 2)}");
            Console.WriteLine($"b(16) = {b = new NAry(b, 16)}");
            Console.WriteLine($"{a}({a.ToDouble()}) + {b}({b.ToDouble()}) = {a + b}({(a + b).ToDouble()})");


            Console.ReadKey(true);
        }
Пример #2
0
        private void Button1_Click(object sender, EventArgs e)
        {
            enter = true;
            NAry result;

            if (exc)
            {
                result        = new NAry(textBox2.Text, (byte)numericUpDown1.Value);
                textBox1.Text = result.ToDouble().ToString();
            }
            else
            {
                result        = new NAry(double.Parse(textBox1.Text), (byte)numericUpDown1.Value);
                textBox2.Text = result.ToString();
            }
        }