Пример #1
0
        private void txtSubsetSize_TextChanged(object sender, System.EventArgs e)
        {
            long n = int.Parse(txtTotalItems.Text);
            long k = int.Parse(txtSubsetSize.Text);

            txtNumCombinations.Text = Combination.Choose(n, k).ToString();
        }
Пример #2
0
        static void Main()
        {
            long n = 4;
            long k = 2;

            Console.WriteLine("With n = " + n + ", and k = " + k);
            Console.WriteLine("There are " + Combination.Choose(n, k) + " combinations\n");

            Combination c = new Combination(n, k);

            Console.WriteLine("The mathematical combinations are:");
            while (c != null)
            {
                Console.WriteLine(c.ToString());
                c = c.Successor();
            }
            Console.ReadLine();
        } // Main()