Here's how it would work with your program:

by Solitaire (Login Solitaire1)
S

 

I'm just replacing the repetitious part of your code with simple short arrays:


DIM count AS INTEGER
DIM CNT(49) AS INTEGER
DIM BNUM(49) AS INTEGER

'COUNT TIMES EACH NUMBER OCCURS
FOR count = 1 TO 49
    IF BNUM(count) = count THEN CNT(count) = CNT(count) + 1
NEXT count



PS: The convention in programming is to use lowercase letters for variable names, and uppercase letters for constants. Using all uppercase letters the way you have been doing it, makes it very hard to read the code.

(Pete may disagree with me, but he marches by another drummer.)


Posted on Dec 20, 2009, 2:14 PM

Respond to this message   

Return to Index

Response TitleAuthor and Date
Thanks, but....unseenmachine on Dec 20
 Sure. Here is the Bubble Sort algorithm:Solitaire on Dec 20
  * Ever hear of SWAP? You is doin it in VB :-P on Dec 20
   You're right, Clippy.Solitaire on Dec 20
    * I found that out in VB6. I swapped like you did. on Dec 20
    But you use bubble sortqbguy on Dec 21
     The one I posted was even easier...Pete on Dec 21
      * But that one's just a less optimized bubble sortqbguy on Dec 21
       So?Pete on Dec 21
     * Because it is NOT "intuative" to a new programmer. on Dec 21
      Am i the programmer in question? on Dec 21
       Not really. There are dozens of ways to SORT. Some are not easy to understand. on Dec 21
       I've been coding more years than you've been alive.Pete on Dec 21
      How is bubble sort more intuitive than selection sort?qbguy on Dec 21
       * I use shell sort without a problem. Not everything involves vast arrays. on Dec 21
 Why would you want to change the array data? on Dec 20
  The purpose of it all...well some of it anywayunseenmachine on Dec 20
   The ten most likely would probably be the least used balls, but on Dec 20
   Fun to program but fruitless to use.Pete on Dec 21
    Fot those who are not englishunseenmachine on Dec 21
     * I thought for the lottery the order doesn't matter thoughqbguy on Dec 21
      * Up with disorderly balls the Engish will not put!Sir Winston on Dec 21
     * Just switch < to > 'get the lowest' to 'get the highest' and 1 to 10 for results.Pete on Dec 21
      Done, well to a fashionunseenmachine on Dec 21
       * Well I think that is more than 50 numbers. on Dec 21
        Re. more than 50 numbersunseenmachine on Dec 21
         Of course!Solitaire on Dec 22

 Copyright © 1999-2014 Network54. All rights reserved.   Terms of Use   Privacy Statement