求助FOXPRO编程问题
从1到9这九个整数中随机选取3个,将这2个数求和,如果12《和值《18,显示这3个数。不好意思,是求3个数的和...
从1到9这九个整数中随机选取3个,将这2个数求和,如果12《和值《18,显示这3个数。
不 好意思,是求3个数的和 展开
不 好意思,是求3个数的和 展开
2个回答
展开全部
看看下面是不是你想要的:
a1=round(rand()*10,0)
a1 = iif(a1 = 0,1,a1)
llw = .T.
do while llw
a2 = round(rand()*10,0)
a3 = round(rand()*10,0)
llw = (a1 = a2).or.(a2 = a3).or.(a1 = a3).or.;
(a2 = 0).or.(a3 = 0)
enddo
a4 = a1 + a2 + a3
if between(a4,12,18)
?a1,a2,a3
endif
a1=round(rand()*10,0)
a1 = iif(a1 = 0,1,a1)
llw = .T.
do while llw
a2 = round(rand()*10,0)
a3 = round(rand()*10,0)
llw = (a1 = a2).or.(a2 = a3).or.(a1 = a3).or.;
(a2 = 0).or.(a3 = 0)
enddo
a4 = a1 + a2 + a3
if between(a4,12,18)
?a1,a2,a3
endif
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询