键盘练习程序 1994-01-21 整个程序短小精悍,在PC XT,GWBASIC3.22下运行通过。 5 KEY OFF: DIM X(26), Y(26): RANDOMIZE TIMER 10 FOR I = 1 TO 26: READ Y(I), X(I): NEXT 20 CLS : LOCATE 15, 22: PRINT STRING$(39, "-") 30 LOCATE 16, 21: PRINT "| Q | W | E | R | T | Y | U | I | O | P |" 40 LOCATE 17, 22: PRINT STRING$(39, "-") 50 LOCATE 18, 23: PRINT "| A | S | D | F | G | H | J | K | L |" 60 LOCATE 19, 24: PRINT STRING$(35, "-") 70 LOCATE 20, 25: PRINT "| Z | X | C | V | B | N | M |" 80 LOCATE 21, 26: PRINT STRING$(27, "-") 90 LOCATE 7, 25: PRINT STRING$(29, "-") 95 LOCATE 8, 25: PRINT "|"; SPACE$(27); "|" 100 LOCATE 9, 25: PRINT STRING$(29, "-") 110 TIME$ = "00:00": FOR I = 1 TO 10: a$ = "" 120 FOR J = 1 TO 25: a = INT(RND * 26 + 65): a$ = a$ + CHR$(a): NEXT 130 LOCATE 8, 27: PRINT a$: FOR K = 1 TO 25 135 B$ = MID$(a$, K, 1): B = ASC(B$) - 64 140 COLOR 0, 7: LOCATE Y(B), X(B): PRINT B$ 150 C$ = INKEY$ 155 IF C$ = "" THEN 150 ELSE IF ASC(C$) = 27 THEN COLOR 7: GOTO 180 160 IF C$ <> B$ THEN BEEP: GOTO 150 170 S = S + 1: LOCATE 8, 26 + K: PRINT B$ 175 COLOR 7, 0: LOCATE Y(B), X(B): PRINT B$: NEXT: NEXT 180 T = VAL(MID$(TIME$, 4, 2)) + VAL(MID$(TIME$, 7, 2)) / 60 190 COLOR 7, 0: CLS : LOCATE 12, 35: PRINT "SPEED:"; INT(S / T) 200 LOCATE 20, 35: PRINT "GO ON(Y/N)?" 210 K$ = INKEY$: IF K$ = "" THEN 210 ELSE IF K$ <> "N" THEN S = 0: GOTO 20 220 END 500 DATA 18,25,20,43,20,35,18,33,16,31,18,37,18,41,18,45 510 DATA 16,51,18,49,18,53,18,57,20,51,20,47,16,55,16,59,16,23,16,35,18,29 520 DATA 16,39,16,47,20,39,16,27,20,31,16,43,20,27