home *** CD-ROM | disk | FTP | other *** search
-
- '
- ' This program accepts a sentence, then determines its
- ' approximate size, after which it breaks the sentence up
- ' into seperate words.
- ' Then ten numbers are asked for, and they are then
- ' bubble-sorted and displayed
- '
-
-
- dim test(20)
-
- input "Type a sentence >"; s$
- print "s$ is more than 20 chars and less then 50"
- print len(s$) > 20 and len(s$) < 50
- length = len(s$)
-
- ' break s$ up, one line per word
- sLen = len(s$)
- for count = 1 to sLen
- c$ = mid$(s$,count,1)
- copy$ = copy$ + c$
- if c$ = " " then copy$ = copy$ + chr$(13)
- next count
- print copy$
-
- ' ask for 10 numbers to sort
- for count = 1 to 10
- print "Give me number "; count; " >";
- input number
- test(count) = number
- next count
-
- ' outer sort loop
- for outerCount = 1 to 10
-
- ' inner sort loop
- for innerCount = 1 to 9
-
- if test(innerCount) > test(innerCount + 1) then s = test(innerCount) : test(innerCount) = test(innerCount + 1) : test(innerCount + 1) = s
-
- next innerCount
- next outerCount
-
- ' view the sorted array
- for count = 1 to 10
- print test(count)
- next count
-
-