Мова програмування Turbo-Basic
FOR I = 1 TO N - 1
FOR J = I + 1 TO N
IF X$(I) > X$(J) THEN SWAP X$(I), X$(J)
NEXT J, I
FOR I=1 TO N
LOCATE I+3,30
PRINT X$(I)
NEXT I
END
' IМIТАЦIЯ ОБЕРТАHHЯ РИСОЧКИ
'----------------------------------------------------
ON KEY (1) GOSUB 500
KEY (1) ON
CLS
50LOCATE 12,40: PRINT "( ¦ )" : DELAY .1
LOCATE 12,40: PRINT "( / )" : DELAY .1
LOCATE 12,40: PRINT "( - )" : DELAY .1
LOCATE 12,40: PRINT "( \ )" : DELAY .1
GOTO 50
500END
'ПОБУДОВА ДIАГРАМИ
'-----------------------------------
SUB GRAF(NX1,NY1,NX2,NY2,N,Y(1))
SCREEN 2
YMAX=Y(1): YMIN=Y(1)