请大家帮我看下这个程序排准考证的,哪里出错了,排到倒数第二个考时,都会丢倒数第二考室后一个号码
请大家帮我看下这个程序排准考证的,哪里出错了,排到倒数第二个考室时,都会丢倒数第二考室后一个号码例如:排58个考室,第57考室,尾数是5730这个号码就会没掉
程序代码:
GO TOP KDRS = RECCOUNT() KCS = IIF(INT(KDRS / 30) = KDRS / 30,INT(KDRS / 30),INT(KDRS / 30) + 1) WKCRS = KDRS - (KCS - 1) * 30 BZ = 'f' FOR Y = 1 TO 30 STEP 2 FOR X = KCHS TO KCHS + KCS - 1 DO CASE CASE X < 10 KCH = '00' + STR(X,1) CASE X >= 10 AND X < 100 KCH = '0' + STR(X,2) CASE X >= 100 KCH = STR(X,3) ENDCASE DO CASE CASE Y < 10 ZH = '0' + STR(Y,1) CASE Y >= 10 ZH = STR(Y,2) ENDCASE REPLACE ZKH WITH '372' +KCH + ZH SKIP ENDFOR DO CASE CASE (WKCRS / 2) <> INT(WKCRS / 2) IF Y >= WKCRS AND BZ = 'f' KCS = KCS - 1 BZ = 't' LOOP ENDIF CASE WKCRS = 30 IF Y = 29 AND BZ = 'f' KCS = KCS - 1 BZ = 't' LOOP ENDIF CASE (WKCRS / 2) = INT(WKCRS / 2) IF Y >= WKCRS - 2 AND BZ = 'f' KCS = KCS - 1 BZ = 't' LOOP ENDIF ENDCASE ENDFOR BZ = 'f' FOR Y = 2 TO 30 STEP 2 FOR X = KCHS TO KCS + 1 + KCHS - 1 DO CASE CASE X < 10 KCH = '00' + STR(X,1) CASE X >= 10 AND X < 100 KCH = '0' + STR(X,2) CASE X >= 100 KCH = STR(X,3) ENDCASE DO CASE CASE Y < 10 ZH = '0' + STR(Y,1) CASE Y >= 10 ZH = STR(Y,2) ENDCASE REPLACE ZKH WITH '372' + KCH + ZH SKIP IF EOF() EXIT ENDIF ENDFOR IF EOF() EXIT ENDIF DO CASE CASE WKCRS = 30 LOOP CASE (WKCRS / 2) <> INT(WKCRS / 2) IF Y >= WKCRS - 2 AND BZ = 'f' KCS = KCS - 1 BZ = 't' LOOP ENDIF CASE (WKCRS / 2) = INT(WKCRS / 2) IF Y >= WKCRS AND BZ = 'f' KCS = KCS - 1 BZ = 't' LOOP ENDIF ENDCASE ENDFOR IF WKCRS = 30 KCHS = KCHS + KCS + 1 ELSE KCHS = KCHS + KCS + 2 ENDIF RETURN