Announcement

Collapse
No announcement yet.

Array Sort

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Michael Mattias
    replied
    >Note: 1-100 = -99

    Oh, I'm so sorry, Bob, that's not correct. However, we do have some nice parting gifts for you, including the exciting Home Version of the PowerTree Index Manager..

    The correct answer is, "9", THE 'ERR' VALUE FOR WHICH THIS PROGRAM SHOULD HAVE TESTED.

    Leave a comment:


  • Conrad Hoffman
    replied
    99 bottles of beer on the wall, 99 bottles of beer, you take one down, pass it around...

    Sorry, it's Friday, couldn't resist!

    CH

    Leave a comment:


  • Bob Zale
    replied
    Note: 1-100 = -99

    Leave a comment:


  • Martin Francom
    replied
    Originally posted by Keith Eckerman View Post
    If you dimension the array as DIM LIST(1 TO 100) AS STRING it will compile and sort. Apparently compiler does not understand the dimension 1-100.

    Thank you.... Sometimes I just can't see the tree because of the forest.

    Leave a comment:


  • Keith Eckerman
    replied
    As Martin wrote:
    DIM LIST(1-100) AS STRING
    PRINT LBOUND(LIST());","; UBOUND(LIST())

    The PBCC5.0 compiler indicates the lower bound to be 0, upper bound is -1.

    Leave a comment:


  • Michael Mattias
    replied
    ADD TWO LINES AND RUN THIS:
    Code:
    FUNCTION PBMAIN () AS LONG
        
        DIM LIST(1-100) AS STRING
        PRINT ERR         ' ADD ME 
        WAITKEY$         ' ME TOO
        
        LIST (1) = "<ZZMYPROG>"
        LIST (2) = "<MOUNTAIN>"
        LIST (3) = "<BLUEBERRY>"
        LIST (4) = "<APPLES>"
        LIST (5) = "<CHERRIES>"
        
        ARRAY SORT LIST (), DESCEND
        
        PRINT LIST (1)
        PRINT LIST (2)
        PRINT LIST (3)
        PRINT LIST (4)
        PRINT LIST (5)
        
        WAITKEY$
    
    END FUNCTION
    MCM
    (You didn't really want to "DIM LINE (0 TO minus ninety-nine), did you?)

    Leave a comment:


  • Keith Eckerman
    replied
    Array Sort

    If you dimension the array as DIM LIST(1 TO 100) AS STRING it will compile and sort. Apparently compiler does not understand the dimension 1-100.
    Last edited by Keith Eckerman; 9 Jan 2009, 11:59 AM.

    Leave a comment:


  • Martin Francom
    replied
    Tryed both ways. Program compiles but does not show any results and then get Windows message "Program not responding".

    Note: Using Windows Vista.
    Last edited by Martin Francom; 9 Jan 2009, 11:31 AM. Reason: additional info

    Leave a comment:


  • Michael Mattias
    replied
    OR...
    Code:
    ARRAY SORT list[COLOR="Red"](1) FOR 5[/COLOR], DESCEND

    Leave a comment:


  • Ralph Bing
    replied
    try and change the dimension of the array to 10 and print all ten

    Leave a comment:


  • Martin Francom
    started a topic Array Sort

    Array Sort

    I must be missing something. I can't seem to get ARRAY SORT to sort a simple array. Can someone show me what I am doing wrong?

    Code:
    FUNCTION PBMAIN () AS LONG
        
        DIM LIST(1-100) AS STRING
        
        LIST (1) = "<ZZMYPROG>"
        LIST (2) = "<MOUNTAIN>"
        LIST (3) = "<BLUEBERRY>"
        LIST (4) = "<APPLES>"
        LIST (5) = "<CHERRIES>"
        
        ARRAY SORT LIST (), DESCEND
        
        PRINT LIST (1)
        PRINT LIST (2)
        PRINT LIST (3)
        PRINT LIST (4)
        PRINT LIST (5)
        
        WAITKEY$
    
    END FUNCTION
    This program does not sort the array. Why? What's wrong?
Working...
X