Hi, Friends
I have written some code after testing it comment about it and I have also an idea, if anybody can write code about it.
First my code:-
_FULLSCREEN
DIM n(15) AS STRING
DIM a AS INTEGER
DIM b AS INTEGER
CLS
PRINT STRING$(79, "-")
PRINT "Sr.No"; TAB(8); "Original"; TAB(30); "Ascending"; TAB(50); "Descending"
PRINT STRING$(79, "-")
FOR a = 1 TO 15
LOCATE a + 3, 1
PRINT a
LOCATE a + 3, 8
INPUT "", n(a)
NEXT a
REM Ascending Order
FOR a = 1 TO 15
FOR b = 1 TO 14
IF n(b) > n(b + 1) THEN SWAP n(b), n(b + 1)
NEXT
NEXT
REM Print Ascending Order
FOR a = 1 TO 15
LOCATE a + 3, 30
PRINT n(a)
NEXT
REM Descending Order
FOR a = 1 TO 15
FOR b = 1 TO 14
IF n(b) < n(b + 1) THEN SWAP n(b), n(b + 1)
NEXT
NEXT
REM Print Decending Order
FOR a = 1 TO 15
LOCATE a + 3, 50
PRINT n(a)
NEXT
PRINT STRING$(79, "-")
SLEEP
SYSTEM
Now the Idea
In this code I tried to input and display the the contents of array in both ascending as well as descending order on same screen, but all this is done first the contents are inputted and then displayed in ascending and descending order how it can be done then when the first item of content is inputted at that time the same is displayed in ascending order and then in descending order similarly when the second content is inputted the first and second contents of array are checked and then displayed in both ascending as well as descending order accordingly and then so on until last item is inputted.
The Example is as below
Upon First Input
Sr. No Order Ascending Descending
1 Bob Bob Bob
Upon Second Input
Sr. No Order Ascending Descending
1 Bob Allan Bob
2 Allan Bob Allan
Upon Third input
Sr. No Order Ascending Descending
1 Bob Allan Carl
2 Allan Bob Bob
3 Carl Carl Allan
and this process continue until last item.
I am waiting for the code from all friends.
Thanks
ChatKing