VFP程序:输入十个数来排序大小

2024-12-11 16:55:06
推荐回答(1个)
回答1:

CLOSE ALL
CLEAR ALL
CLEAR
SET TALK OFF
RAND(-1)
DIMENSION aMyArray(10) AS NUMERIC
?
?"生成了以下十个随机数:"
?
?
FOR nLoop_01 = 1 TO 10
aMyArray(nLoop_01) = INT(RAND() * 100) + 1
??aMyArray(nLoop_01)
NEXT
= ASORT(aMyArray)
?
?
?"升序显示这十个随机数:"
?
FOR nLoop_02 = 1 TO 10
??aMyArray(nLoop_02)
NEXT
= ASORT(aMyArray, 1, 0, 1)
?
?
?"降序显示这十个随机数:"
?
FOR nLoop_03 = 1 TO 10
??aMyArray(nLoop_03)
NEXT
SET TALK ON