コード例 #1
0
        /* main函数 */
        static void Main(string[] args)
        {
            // DataOp dataOp = new DataOp();
            // dataOp.Demo();

            // LogicOp logicOp = new LogicOp();
            // logicOp.DemoBranch();
            // logicOp.DemoLoop();

            ListOp listOp = new ListOp();

            listOp.Demo();

            Console.ReadKey();
        }
コード例 #2
0
    public override object Apply(object a)
    {
        System.String[] args = Environment.GetCommandLineArgs();
        int             len  = args.Length;

        if (len == 2)
        {
            return(1);
        }
        else
        {
            TagVal head = ListOp.Cons(args[len - 1], 1);
            for (int i = len - 2; i >= 2; i--)
            {
                head = (TagVal)ListOp.Cons(args[i], head);
            }
            return(head);
        }
    }
コード例 #3
0
        static void Main(string[] args)
        {
            Console.ForegroundColor = ConsoleColor.White;
            //Mathematics mathematics = new Mathematics();
            //MathematicsOut mathematicsOut = new MathematicsOut();

            MathematicsInAnotherProj mathematicsInAnotherProj = new MathematicsInAnotherProj();

            Console.WriteLine("Enter the  value of a and b for mathematics operation");
            int a      = int.Parse(Console.ReadLine());
            int b      = int.Parse(Console.ReadLine());
            int result = mathematicsInAnotherProj.Sum(a, b);

            Console.WriteLine("Addition result is {0}", result);
            Console.WriteLine("Addition result is {0}", mathematicsInAnotherProj.Sum(a, b));

            Console.WriteLine("Substraction result is {0}", mathematicsInAnotherProj.Substract(a, b));

            Console.WriteLine("Multiplication result is {0}", mathematicsInAnotherProj.Multiply(a, b));

            Console.WriteLine("Division result is {0}", mathematicsInAnotherProj.DivisionRemainder(a, b));

            Console.ForegroundColor = ConsoleColor.DarkMagenta;
            Console.WriteLine("*************************************List Operation **********************************");
            ListOp listOp = new ListOp();

            List <int> obj = listOp.AddInteger();

            foreach (int item in obj)
            {
                Console.WriteLine(item);

                if (item == 78)
                {
                    Console.WriteLine(item);
                }
            }

            var removedData = listOp.RemoveIntegerFromList(obj, 78);

            Console.WriteLine("*************************************After Removal List Items**********************************");
            foreach (int item in removedData)
            {
                Console.WriteLine(item);

                if (item == 78)
                {
                    Console.WriteLine(item);
                }
            }

            var removedAllData = listOp.RemovemAllitemFromList(obj, 78);

            Console.WriteLine("*************************************After Removal All Items**********************************");
            foreach (int item in removedAllData)
            {
                Console.WriteLine(item);

                if (item == 78)
                {
                    Console.WriteLine(item);
                }
            }

            Console.ReadKey();
        }