数学
Visual Foxpro程序设计求助(4)随机数排序由计算机自动产生一组N个具有1位整数2位小数组成的随机数字,并按照由小到大及由大到小的顺序进行排列输出.

2019-05-30

Visual Foxpro程序设计求助(4)
随机数排序
由计算机自动产生一组N个具有1位整数2位小数组成的随机数字,并按照由小到大及由大到小的顺序进行排列输出.
优质解答
我上机验证过了,正确!
clear
input "请输入N的个数:" to n
dime a(n)
for i=1 to n
x=int(10*rand())
y=round(rand(),2)

a(i)=x+y
?a(i)
endfor
for i=1 to n-1
for j=i+1 to n
if a(i)
我上机验证过了,正确!
clear
input "请输入N的个数:" to n
dime a(n)
for i=1 to n
x=int(10*rand())
y=round(rand(),2)

a(i)=x+y
?a(i)
endfor
for i=1 to n-1
for j=i+1 to n
if a(i)
相关问答