vb6 - insert item in unsorted array -


Please help me solve this problem

  • Enter elements of the array: 1 < / Li>
  • Enter the size of an array: 2
  • Enter the entry location: 2
  • Enter the item to insert Do: 5

    After the insertion: <

  • 5
  • 2
  • 3

    This is the code that I already did

      dim one (50) as integer, n integer, loc as integer, item integer As, integer private sub Form_Load () I dim integer N = InputBox (as in x "Enter the size of an array:", "size") for Text1.Text = "" I = 1 na (i) = InputBox ("Enter Elemts of an Array:", "Element") Next I place = InputBox ("Enter the location of the entry:", "location") object = input box ( "Enter item to insert:", "item"), text = 1 for n from n = 1. Text = text1 Text + "" & amp; A (i) list1.AddItem Text1.Text Text1.Text = "Next" I finished sub-sub-unsorted () while i & gt; = (Place - 1) i (i + 1) i (i) = i = i + 1 wand a (place - 1) = item n = n + 1 end sub   

    If there is an error in the loop Please help me

    Something like this:

      Option Clear Private Command 1_Click () Dim intLoop integer as inco () as integer ReDim Inta (2) integer dim intIndex integer dim intVal integer inta as as (0) = 1 Inta (1) = 2 Inta (2) = 3 intIndex = 2 intVal = 5 intA = InsertVal (intA, intIndex, intVal) print from IntLoop = 0 to UBound (intA) CStr (intlup) & amp; ":" & Amp; CSTR (Inta (intLoop)) The next intLoop end subs is a functional intel (intSc) integer, intIndex integer, as intVal integer () as integer () dim intLoop integer dim intAdded integer as dim intResult ( As intangible as integer reDim (int (b) for IntAdded = 0 intLoop = 0 to UBound (intSrc) for IntBid (intSrc) + 1 intDesign intDs = intIndex then intResult (intIndex) = intVal intAdded = intAdded +1 end then intResult (intLoop + intAdded) = intSrc (intLoop) Next intLoop InsertVal = intResult termination function    

  • Comments

    Popular posts from this blog

    php - PDO bindParam() fatal error -

    logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

    java - Why my included JSP file won't get processed correctly? -