public static void subset_by_size_next_test() //****************************************************************************80 // // Purpose: // // SUBSET_BY_SIZE_NEXT_TEST tests SUBSET_BY_SIZE_NEXT. // // Licensing: // // This code is distributed under the GNU LGPL license. // // Modified: // // 09 June 2015 // // Author: // // John Burkardt // { Console.WriteLine(""); Console.WriteLine("SUBSET_BY_SIZE_NEXT_TEST"); Console.WriteLine(" SUBSET_BY_SIZE_NEXT generates all subsets of an N set."); Console.WriteLine(""); const int n = 5; int[] a = new int[n]; int subsize = 0; bool more = false; bool more2 = false; int m = 0; int m2 = 0; int rank = 0; for (;;) { Subset.subset_by_size_next(n, ref a, ref subsize, ref more, ref more2, ref m, ref m2); rank += 1; string cout = rank.ToString().PadLeft(4) + " "; switch (subsize) { case > 0: { int i; for (i = 0; i < subsize; i++) { cout += a[i].ToString().PadLeft(2) + " "; } Console.WriteLine(cout); break; } default: Console.WriteLine("The empty set"); break; } if (!more) { break; } } }