Announcement

Collapse
No announcement yet.

Sorry, meant data

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

  • Sorry, meant data

    Sorry, I meant to ask how I could read the data(which are names)
    and then get the longest name, and shortest name, and display
    the names, example: Mand 4
    got 3
    john 4
    bobby 5

    longest name is: bobby
    shortest name is: got

    Sorry about the mix up.


    -------------
    Kro121
    Kro121

  • #2
    What I would do is store all the names in array, for example, a$(). Let's assume that (I) points to the last entry in the array. Try this routine:

    short_number = 99999
    long_number = 0
    for x = 1 to i
    LL = len(a$(x))
    if LL < short_number then
    short_number = LL
    short_name$ = a$(x)
    end if

    if LL > long_number then
    long_number = LL
    long_name$ = a$(x)
    end if
    next x

    Looking at this, you can modify it to read DATA statements if you wish, making sure you put an end-of-data flag at the end of the statements.

    Also, I may have the "<" and ">" reversed. Give it a shot and see what happens.
    There are no atheists in a fox hole or the morning of a math test.
    If my flag offends you, I'll help you pack.

    Comment


    • #3
      Karl, If you want to use Lance's example from your
      preious Post, fill your array using READ instead of
      LINE INPUT

      DIM A$(1000)
      FOR x% = 1 to 4 '..........count your number of names in DATA
      READ A$(x%)
      NEXT

      DATA "Mand","Got","John","Bobby"

      You can now use the rest of Lance's example



      ------------------

      Comment

      Working...
      X