江湖告急,老狐请进!急!!! 我编了一个体育彩票排列5的程序:
clea
dime x(2,5),k(5) x(1,1)=3 x(1,2)=6 x(1,3)=2 x(1,4)=2 x(1,5)=3 x(2,1)=0 x(2,2)=4 x(2,3)=4 x(2,4)=1 x(2,5)=5
k(1)="a" k(2)="b" k(3)="c" k(4)="d" k(5)="e" for a=0to 9 for b=0to 9 for c=0to 9 for d=0to 9 for e=0to 9
************************************************************** for m=1to 2 for j=1to 5 for i=1to 5 r="n"+str(m,1)+k(j)+k(i) &r=&k(j)+x(m,i) if &r>=10 &r=&r-10 endi r3=r+"3" do case case &r%3=0 &r3=3 case &r%3=1 &r3=1 case &r%3=2 &r3=2 endc r4=r+"4" do case case &r=1.or.&r=5.or.&r=9 &r4=1 case &r=2.or.&r=6.or.&r=8.or.&r=4 &r4=2 case &r=0.or.&r=3.or.&r=7 &r4=3 endc r5=r+"5" do case case &r=1.or.&r=4.or.&r=9.or.&r=6 &r5=1 case &r=2.or.&r=5.or.&r=7 &r5=2 case &r=0.or.&r=3.or.&r=8 &r5=3 endc endf endf endf *************************************************************** if n1aa3=2 ?a,b,c,d,e wait endi
************************ endf endf endf endf endf retu
func gg para a1,a2,a3,a4,a5 dime x(5) x(1)=a1 x(2)=a2 x(3)=a3 x(4)=a4 x(5)=a5 for i=1to 5 for j=i+1to 5 if x(i)>x(j) t=x(i) x(i)=x(j) x(j)=t endi endf endf s=5 for i=1to 4 if x(i)=x(i+1) s=s-1 endi endf retu
运行后正确,第一个号码应该是a最小为2,运行结果为:20000,20001,等等
但是当我把自定义函数用上后,即加上程序段:
gs=gg(a,b,c,d,e) do case case gs%3=0 gs3=3 case gs%3=1 gs3=1 case gs%3=2 gs3=2 endc do case case gs=1.or.gs=5.or.gs=9 gs4=1 case gs=2.or.gs=6.or.gs=8.or.gs=4 gs4=2 case gs=0.or.gs=3.or.gs=7 gs4=3 endc ********************************* do case case gs=1.or.gs=4.or.gs=6.or.gs=9 gs5=1 case gs=2.or.gs=5.or.gs=7 gs5=2 case gs=0.or.gs=3.or.gs=8 gs5=3 endc
输出条件不变,仍是if n1aa3=2
结果却变了,为11111,11112等等
但是第一个数a不可能为1,百思不得其解,望高手指点,Thank you very much. |