public static void comb_next_test() //****************************************************************************80 // // Purpose: // // COMB_NEXT_TEST tests COMB_NEXT. // // Licensing: // // This code is distributed under the GNU LGPL license. // // Modified: // // 10 April 2009 // // Author: // // John Burkardt // { const int N = 5; int[] a = new int[N]; int k; Console.WriteLine(""); Console.WriteLine("COMB_NEXT_TEST"); Console.WriteLine(" COMB_NEXT produces combinations."); for (k = 1; k <= N; k++) { Console.WriteLine(""); Console.WriteLine(" Combinations of size K = " + k + ""); Console.WriteLine(""); bool done = true; for (;;) { Comb.comb_next(N, k, a, ref done); if (done) { break; } string cout = ""; int i; for (i = 0; i < k; i++) { cout += " " + a[i].ToString().PadLeft(4); } Console.WriteLine(cout); } } }