February 6, 2020

Qbasic Program to sort the random string data in ascending order

DIM a(10) AS STRING
DIM b AS STRING
DIM i AS INTEGER
DIM x AS INTEGER


CLS
FOR i = 1 TO 10
INPUT "enter the string data : ", a(i)
a(i)=UCASE$(a(i))
NEXT i


FOR x = 1 TO 10
        FOR i = 1 TO 10 - j
        IF a(i) > a(i + 1) THEN b = a(i): a(i) = a(i + 1): a(i + 1) = b
        NEXT i
NEXT x


PRINT "The sorted string data in ascending order:"
FOR i = 1 TO 10
PRINT a(i)
NEXT i

END

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.