public static void subset_lex_next_test() //****************************************************************************80 // // Purpose: // // SUBSET_LEX_NEXT_TEST tests SUBSET_LEX_NEXT with size restrictions. // // Licensing: // // This code is distributed under the GNU LGPL license. // // Modified: // // 05 January 2007 // // Author: // // John Burkardt // { const int NDIM = 3; int[] a = new int[NDIM]; const int n = 5; Console.WriteLine(""); Console.WriteLine("SUBSET_LEX_NEXT_TEST"); Console.WriteLine(" SUBSET_LEX_NEXT generates all subsets of an N set."); Console.WriteLine(" The user can impose a restriction on the"); Console.WriteLine(" maximum size of the subsets."); Console.WriteLine(""); Console.WriteLine(" Here, we require the subsets to be no larger"); Console.WriteLine(" than NDIM = " + NDIM + ""); int k = 0; for (;;) { bool ltest = k == NDIM; Subset.subset_lex_next(n, ltest, NDIM, ref k, ref a); switch (k) { case > 0: { string cout = " "; int i; for (i = 0; i < k; i++) { cout += a[i].ToString().PadLeft(2) + " "; } Console.WriteLine(cout); break; } default: Console.WriteLine(" The empty set."); break; } if (k == 0) { break; } } }