fork download
  1. Imports System
  2.  
  3. Public Class Test
  4.  
  5.  
  6. Dim mvArr As Variant
  7. Dim maResult() As String
  8. Dim maInclude() As Long
  9. Dim mlElementCount As Long
  10. Dim mlResultCount As Long
  11.  
  12. Public Shared Sub Main()
  13. ' your code goes here
  14.  
  15. Allcombos
  16.  
  17. End Sub
  18.  
  19. Sub AllCombos()
  20.  
  21. Dim i As Long
  22.  
  23. 'Initialize arrays and variables
  24. Erase maInclude
  25. Erase maResult
  26. mlResultCount = 0
  27.  
  28. 'Create array of possible substrings
  29. mvArr = Array("NAME", "DESC", "DATE", "ACCOUNT")
  30.  
  31. 'Initialize variables based on size of array
  32. mlElementCount = UBound(mvArr)
  33. ReDim maInclude(LBound(mvArr) To UBound(mvArr))
  34. ReDim maResult(1 To 2 ^ (mlElementCount + 1))
  35.  
  36. 'Call the recursive function for the first time
  37. Eval 0
  38.  
  39. 'Print the results to the immediate window
  40. For i = LBound(maResult) To UBound(maResult)
  41. Console.WriteLine i, maResult(i)
  42. Next i
  43.  
  44. End Sub
  45.  
  46.  
  47. Sub Eval(ByVal lPosition As Long)
  48.  
  49. Dim sConcat As String
  50. Dim i As Long
  51.  
  52. If lPosition <= mlElementCount Then
  53. 'set the position to zero (don't include) and recurse
  54. maInclude(lPosition) = 0
  55. Eval lPosition + 1
  56.  
  57. 'set the position to one (include) and recurse
  58. maInclude(lPosition) = 1
  59. Eval lPosition + 1
  60. Else
  61. 'once lPosition exceeds the number of elements in the array
  62. 'concatenate all the substrings that have a corresponding 1
  63. 'in maInclude and store in results array
  64. mlResultCount = mlResultCount + 1
  65. For i = 0 To UBound(maInclude)
  66. If maInclude(i) = 1 Then
  67. sConcat = sConcat & mvArr(i) & Space(1)
  68. End If
  69. Next i
  70. sConcat = Trim(sConcat)
  71. maResult(mlResultCount) = sConcat
  72. End If
  73.  
  74. End Sub
  75.  
  76. End Class
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Visual Basic.Net Compiler version 0.0.0.5943 (Mono 3.8 - tarball)
Copyright (C) 2004-2010 Rolf Bjarne Kvinge. All rights reserved.

/home/HRUxdp/prog.vb (6,21) : error VBNC30180: Keyword does not name a type.
/home/HRUxdp/prog.vb (7,4): Compiler error around this location, the compiler hasn't implemented the error message, nor error recovery, so the compiler will probably crash soon.
   at vbnc.Helper.ErrorRecoveryNotImplemented(Span Location)
   at vbnc.Parser.ParseVariableDeclarator(vbnc.ParsedObject Parent, Modifiers Modifiers, vbnc.ParseAttributableInfo Info, IList result, Boolean local)
   at vbnc.Parser.ParseTypeVariableDeclarator(vbnc.ParsedObject Parent, Modifiers Modifiers, vbnc.ParseAttributableInfo Info)
   at vbnc.Parser.ParseTypeVariableDeclarators(vbnc.ParsedObject Parent, Modifiers Modifiers, vbnc.ParseAttributableInfo Info)
   at vbnc.Parser.ParseTypeVariableMemberDeclaration(vbnc.ParsedObject Parent, vbnc.ParseAttributableInfo Info)
   at vbnc.Parser.ParseTypeMembers(vbnc.TypeDeclaration Parent)
   at vbnc.Parser.ParseClassDeclaration(vbnc.ParsedObject Parent, vbnc.Attributes Attributes, System.String Namespace)
   at vbnc.Parser.ParseTypeDeclaration(vbnc.ParsedObject Parent, vbnc.Attributes Attributes, System.String Namespace)
   at vbnc.Parser.ParseAssemblyMembers(vbnc.AssemblyDeclaration Parent, System.String RootNamespace)
   at vbnc.Parser.ParseAssemblyDeclaration(System.String RootNamespace, vbnc.AssemblyDeclaration assembly)
   at vbnc.Parser.Parse(System.String RootNamespace, vbnc.AssemblyDeclaration assembly)
   at vbnc.Compiler.Compile_Parse()
   at vbnc.Compiler.Compile()
   at vbnc.Compiler.Compile(System.String[] CommandLine)
   at vbnc.Main.Main(System.String[] CmdArgs)
/home/HRUxdp/prog.vb (33,44) : error VBNC90019: Expected ')'.
/home/HRUxdp/prog.vb (33,44): Compiler error around this location, the compiler hasn't implemented the error message, nor error recovery, so the compiler will probably crash soon.
   at vbnc.Helper.ErrorRecoveryNotImplemented(Span Location)
   at vbnc.Parser.ParseInvocationOrIndexExpression(vbnc.ParsedObject Parent, vbnc.Expression First)
   at vbnc.Parser.ParseIdentifier(vbnc.ExpressionParseInfo Info)
   at vbnc.Parser.ParseExponent(vbnc.ExpressionParseInfo Info)
   at vbnc.Parser.ParseUnaryPlusMinus(vbnc.ExpressionParseInfo Info)
   at vbnc.Parser.ParseMultDiv(vbnc.ExpressionParseInfo Info)
   at vbnc.Parser.ParseIntDiv(vbnc.ExpressionParseInfo Info)
   at vbnc.Parser.ParseMod(vbnc.ExpressionParseInfo Info)
   at vbnc.Parser.ParsePlusMinus(vbnc.ExpressionParseInfo Info)
   at vbnc.Parser.ParseConcat(vbnc.ExpressionParseInfo Info)
   at vbnc.Parser.ParseBitshift(vbnc.ExpressionParseInfo Info)
   at vbnc.Parser.ParseComparison(vbnc.ExpressionParseInfo Info)
   at vbnc.Parser.ParseNot(vbnc.ExpressionParseInfo Info)
   at vbnc.Parser.ParseAnd_AndAlso(vbnc.ExpressionParseInfo Info)
   at vbnc.Parser.ParseOr_OrElse_Xor(vbnc.ExpressionParseInfo Info)
   at vbnc.Parser.ParseExpression(vbnc.ParsedObject Parent)
   at vbnc.Parser.ParseRedimClause(vbnc.ParsedObject Parent)
   at vbnc.Parser.ParseList(vbnc.BaseList`1 List, vbnc.ParseDelegate_Parent`1 ParseMethod, vbnc.ParsedObject Parent)
   at vbnc.Parser.ParseRedimClauses(vbnc.ReDimStatement Parent)
   at vbnc.Parser.ParseReDimStatement(vbnc.ParsedObject Parent)
   at vbnc.Parser.ParseCodeBlock(vbnc.ParsedObject Parent, Boolean IsOneLiner)
   at vbnc.Parser.ParseSubDeclaration(vbnc.TypeDeclaration Parent, vbnc.ParseAttributableInfo Info)
   at vbnc.Parser.ParseTypeMembers(vbnc.TypeDeclaration Parent)
   at vbnc.Parser.ParseClassDeclaration(vbnc.ParsedObject Parent, vbnc.Attributes Attributes, System.String Namespace)
   at vbnc.Parser.ParseTypeDeclaration(vbnc.ParsedObject Parent, vbnc.Attributes Attributes, System.String Namespace)
   at vbnc.Parser.ParseAssemblyMembers(vbnc.AssemblyDeclaration Parent, System.String RootNamespace)
   at vbnc.Parser.ParseAssemblyDeclaration(System.String RootNamespace, vbnc.AssemblyDeclaration assembly)
   at vbnc.Parser.Parse(System.String RootNamespace, vbnc.AssemblyDeclaration assembly)
   at vbnc.Compiler.Compile_Parse()
   at vbnc.Compiler.Compile()
   at vbnc.Compiler.Compile(System.String[] CommandLine)
   at vbnc.Main.Main(System.String[] CmdArgs)
/home/HRUxdp/prog.vb (33,44) : error VBNC90019: Expected 'End'.
/home/HRUxdp/prog.vb (34,10) : error VBNC90019: Expected 'End'.
/home/HRUxdp/prog.vb (37,9) : error VBNC30203: Identifier expected.
/home/HRUxdp/prog.vb (40,8) : error VBNC30203: Identifier expected.
/home/HRUxdp/prog.vb (41,16) : error VBNC30203: Identifier expected.
/home/HRUxdp/prog.vb (42,9) : error VBNC30203: Identifier expected.
/home/HRUxdp/prog.vb (44,8) : error VBNC30203: Identifier expected.
/home/HRUxdp/prog.vb (47,4) : error VBNC30203: Identifier expected.
/home/HRUxdp/prog.vb (49,8) : error VBNC30203: Identifier expected.
/home/HRUxdp/prog.vb (50,8) : error VBNC30203: Identifier expected.
/home/HRUxdp/prog.vb (52,7) : error VBNC30203: Identifier expected.
/home/HRUxdp/prog.vb (54,18) : error VBNC30203: Identifier expected.
/home/HRUxdp/prog.vb (55,13) : error VBNC30203: Identifier expected.
/home/HRUxdp/prog.vb (58,18) : error VBNC30203: Identifier expected.
/home/HRUxdp/prog.vb (59,13) : error VBNC30203: Identifier expected.
/home/HRUxdp/prog.vb (60,9) : error VBNC30203: Identifier expected.
/home/HRUxdp/prog.vb (64,22) : error VBNC30203: Identifier expected.
/home/HRUxdp/prog.vb (65,12) : error VBNC30203: Identifier expected.
/home/HRUxdp/prog.vb (66,15) : error VBNC30203: Identifier expected.
/home/HRUxdp/prog.vb (67,24) : error VBNC30203: Identifier expected.
/home/HRUxdp/prog.vb (68,19) : error VBNC30203: Identifier expected.
/home/HRUxdp/prog.vb (69,13) : error VBNC30203: Identifier expected.
/home/HRUxdp/prog.vb (70,16) : error VBNC30203: Identifier expected.
/home/HRUxdp/prog.vb (71,17) : error VBNC30203: Identifier expected.
/home/HRUxdp/prog.vb (72,11) : error VBNC30203: Identifier expected.
/home/HRUxdp/prog.vb (74,8) : error VBNC30203: Identifier expected.
/home/HRUxdp/prog.vb (76,10) : error VBNC30203: Identifier expected.
There were 29 errors and 0 warnings.
Compilation took 00:00:00.6378600
stdout
Standard output is empty