主题:终于编出了打印26个英文大写字母的程序(用“*”)
比如————
输入:AB
5
输出(每输出一个超大字母按一次空格):
A
A A
AAAAA
A A
A A
BBBBB
B B
BBBBB
B B
BBBBB
输入:AB
7
输出:
A
A A
A A
AAAAAAA
A A
A A
A A
BBBBBBB
B B
B B
BBBBBBB
B B
B B
BBBBBBB
程序如下:
CLS
0 INPUT a$
DO
INPUT n
LOOP UNTIL n > 4
FOR q = 1 TO LEN(a$)
n$ = MID$(a$, q, 1)
GOSUB Zh
SLEEP
NEXT q
END
Zh:
SELECT CASE n$
CASE "A"
PRINT TAB(n); "A"
FOR i = 2 TO n
PRINT TAB(n + 1 - i);
IF i <> FIX(n / 2 + .5) THEN
PRINT "A"; SPC((i - 1) * 2 - 1); "A"
ELSE
PRINT STRING$((i - 1) * 2 + 1, "A")
END IF
NEXT i
CASE "B"
FOR i = 1 TO 2
PRINT STRING$(n, "B")
x = n
FOR j = 1 TO (n - 3) \ 2
IF ((n - 3) \ 2) MOD 2 = 0 AND j = (n - 3) \ 2 \ 2 + 1 THEN 1
IF j > (n - 3) \ 2 \ 2 + 1 THEN x = x - 1 ELSE x = x + 1
1 PRINT "B"; TAB(x); "B"
NEXT j
NEXT i
PRINT STRING$(n, "B")
CASE "C"
PRINT SPC(FIX(n / 2 - .5)); STRING$(n, "C")
x = FIX(n / 2 + .5)
FOR i = 2 TO n - 1
IF i > FIX(n / 2 + .5) THEN x = x + 1 ELSE x = x - 1
PRINT TAB(x); "C"
NEXT i
PRINT TAB(FIX(n / 2 + .5)); STRING$(n, "C")
CASE "D"
PRINT STRING$(n, "D")
x = n
FOR i = 2 TO n - 1
PRINT "D";
IF i > FIX(n / 2 + .5) THEN x = x - 1 ELSE x = x + 1
PRINT TAB(x); "D"
NEXT i
PRINT STRING$(n, "D")
CASE "E"
FOR i = 1 TO 2
PRINT STRING$(n, "E")
FOR j = 1 TO FIX(n / 2 - 1.5)
PRINT "E"
NEXT j, i
PRINT STRING$(n, "E")
CASE "F"
FOR i = 1 TO 2
PRINT STRING$(n + 1, "F")
FOR j = 1 TO FIX(n / 2 - 1.5)
PRINT "F"
NEXT j, i
PRINT "F"
CASE "G"
PRINT SPC(FIX(n / 2 - .5)); STRING$(n, "G")
x = FIX(n / 2 + .5)
FOR i = 2 TO FIX(n / 2 - .5)
x = x - 1
PRINT TAB(x); "G"
NEXT i
PRINT "G"; TAB(n); STRING$(FIX(n / 2 + .5), "G")
FOR i = FIX(n / 2 + 1.5) TO n - 1
x = x + 1
PRINT TAB(x - 1); "G"; TAB(n + FIX(n / 2 - .5)); "G"
NEXT i
PRINT SPC(FIX(n / 2 - .5)); STRING$(n, "G")
CASE "H"
FOR i = 1 TO n
IF i <> FIX(n / 2 + .5) THEN
PRINT "H"; TAB(n); "H"
ELSE
PRINT STRING$(n, "H")
END IF
NEXT i
CASE "I"
PRINT STRING$(n, "I")
FOR i = 2 TO n - 1
PRINT TAB(FIX(n / 2 + .5)); "I"
NEXT i
PRINT STRING$(n, "I")
CASE "J"
PRINT STRING$(n, "J")
FOR i = 1 TO FIX(n / 2 - .5)
PRINT TAB(FIX(n / 2 + .5)); "J"
NEXT i
FOR i = 1 TO n \ 2 - ABS((n \ 2) MOD 2 = 1)
PRINT "J"; TAB(FIX(n / 2 + .5)); "J"
NEXT i
PRINT " " + STRING$(FIX(n / 2 - 1.5), "J")
CASE "K"
x = n - (n \ 2 - 2)
FOR i = 1 TO n
IF i > FIX(n / 2 + .5) THEN x = x + 1 ELSE x = x - 1
PRINT "K"; TAB(x); "KK"
NEXT i
CASE "L"
FOR i = 1 TO n - 1
PRINT "L"
NEXT i
PRINT STRING$(n, "L")
CASE "M"
PRINT "M"; TAB(n * 2 - 1); "M"
x = 1
FOR i = 2 TO n - 1
x = x + 1
PRINT "M"; TAB(x); "M"; TAB(n * 2 - x); "M";
PRINT TAB(n * 2 - 1); "M"
NEXT i
PRINT "M"; TAB(FIX((n * 2 - 1) / 2 + .5)); "M"; TAB(n * 2 - 1); "M";
CASE "N"
PRINT "N"; TAB(n); "N"
x = 1
FOR i = 2 TO n - 1
x = x + 1
PRINT "N"; TAB(x); "N"; TAB(n); "N"
NEXT i
PRINT "N"; TAB(n); "N"
CASE "O"
x = FIX(n / 2 + .5)
PRINT TAB(x); STRING$(n - 1, "O")
y = x + n - 2
IF n MOD 2 = 0 THEN z = n - 2 ELSE z = n - 1
FOR i = 2 TO z
IF i > FIX(n / 2 + .5) THEN
x = x + 1: y = y - 1
ELSE
x = x - 1: y = y + 1
END IF
PRINT TAB(x); "O"; TAB(y); "O"
NEXT i
PRINT TAB(FIX(n / 2 + .5)); STRING$(n - 1, "O")
CASE "P"
PRINT STRING$(n, "P")
x = n
FOR i = 1 TO (n - 3) \ 2
IF (n - 3) \ 2 MOD 2 = 0 AND i = (n - 3) \ 2 \ 2 + 1 THEN 2
IF i > (n - 3) \ 2 \ 2 + 1 THEN x = x - 1 ELSE x = x + 1
2 PRINT "P"; TAB(x); "P"
NEXT i
PRINT STRING$(n, "P")
FOR i = 1 TO FIX(n / 2 - .5)
PRINT "P"
NEXT i
CASE "Q"
x = FIX(n / 2 + .5)
PRINT TAB(x); STRING$(n - 1, "Q")
y = x + n - 2
IF n MOD 2 = 0 THEN z = n - 2 ELSE z = n - 1
FOR i = 2 TO z - 1
IF i > FIX(n / 2 + .5) THEN
x = x + 1: y = y - 1
ELSE
x = x - 1: y = y + 1
END IF
PRINT TAB(x); "Q"; TAB(y); "Q"
NEXT i
PRINT TAB(x + 1); "Q"; TAB(y - 2); "QQ"
PRINT TAB(FIX(n / 2 + .5)); STRING$(n, "Q")
x = n + FIX(n / 2 - .5)
FOR i = 1 TO FIX(n / 2 - 1.5)
x = x + 1
PRINT TAB(x); "Q"
NEXT i
CASE "R"
PRINT STRING$(n, "R")
x = n
FOR i = 1 TO (n - 3) \ 2
IF (n - 3) \ 2 MOD 2 = 0 AND i = (n - 3) \ 2 \ 2 + 1 THEN 3
IF i > (n - 3) \ 2 \ 2 + 1 THEN x = x - 1 ELSE x = x + 1
3 PRINT "R"; TAB(x); "R"
NEXT i
PRINT STRING$(n, "R"): x = 3
FOR i = 1 TO FIX(n / 2 - .5)
PRINT "R"; TAB(x); STRING$(n - 3, "R")
x = x + 1
NEXT i
CASE "S"
PRINT TAB(FIX(n / 2 - .5)); STRING$(n, "S")
x = FIX(n / 2 - .5)
FOR i = 1 TO (n - 3) \ 2
IF (n - 3) \ 2 MOD 2 = 0 AND i = (n - 3) \ 2 \ 2 + 1 THEN 4
IF i > (n - 3) \ 2 \ 2 + 1 THEN x = x + 1 ELSE x = x - 1
4 PRINT TAB(x); "S"
NEXT i
PRINT TAB(FIX(n / 2 - .5)); STRING$(n, "S")
x = n + FIX(n / 2 - 1.5)
FOR i = 1 TO (n - 3) \ 2
IF (n - 3) \ 2 MOD 2 = 0 AND i = (n - 3) \ 2 \ 2 + 1 THEN 5
IF i > (n - 3) \ 2 \ 2 + 1 THEN x = x - 1 ELSE x = x + 1
5 PRINT TAB(x); "S"
NEXT i
PRINT STRING$(n + FIX(n / 2 - 1.5), "S")
CASE "T"
PRINT STRING$(n, "T")
FOR i = 2 TO n
PRINT TAB(FIX(n / 2 + .5)); "T"
NEXT i
CASE "U"
FOR i = 1 TO n - 1
PRINT "U"; TAB(n); "U"
NEXT i
PRINT TAB(2); STRING$(n - 2, "U")
CASE "V"
FOR i = 1 TO n - FIX(n / 2 - .5)
PRINT "V"; TAB(n); "V"
NEXT i
x = 1
FOR i = n - FIX(n / 2 - .5) TO n - 2
x = x + 1
PRINT TAB(x); "V"; TAB(n + 1 - x); "V"
NEXT i
IF n MOD 2 = 1 THEN
PRINT TAB(n \ 2 + 1); "V"
ELSE
PRINT TAB(n / 2); "VV"
END IF
CASE "W"
FOR i = 1 TO n - FIX(n / 2 - .5)
PRINT "W"; TAB(n); "W"; TAB(n + n - 1); "W"
NEXT i
x = 1: y = n
FOR i = n - FIX(n / 2 - .5) TO n - 2
x = x + 1
y = y + 1
PRINT TAB(x); "W"; TAB(n + 1 - x); "W";
PRINT TAB(y); "W"; TAB(n * 2 - (y - n) - 1); "W"
NEXT i
IF n MOD 2 = 1 THEN
PRINT TAB(n \ 2 + 1); "W"; TAB(n + n \ 2); "W"
ELSE
PRINT TAB(n / 2); "WW"; TAB(n + n / 2 - 1); "WW"
END IF
CASE "X"
FOR i = 1 TO FIX(n / 2 - .5)
x = x + 1
PRINT TAB(x); "X"; TAB(n + 1 - x); "X"
NEXT i
IF n MOD 2 = 0 THEN
PRINT TAB(n / 2); "XX"
PRINT TAB(n / 2); "XX"
ELSE
PRINT TAB(n \ 2 + 1); "X"
END IF
x = FIX(n / 2 + .5)
IF n MOD 2 = 0 THEN p = n - 1 ELSE p = n
FOR i = FIX(n / 2 + 1.5) TO p
x = x - 1
PRINT TAB(x); "X"; TAB(n + 1 - x); "X"
NEXT i
CASE "Y"
FOR i = 1 TO FIX(n / 2 - .5)
x = x + 1
IF n MOD 2 = 1 THEN PRINT TAB(x); "Y"; TAB(n + 1 - x); "Y"
IF n MOD 2 = 0 THEN PRINT TAB(x); "YY"; TAB(n + 1 - x); "YY"
NEXT i
IF n MOD 2 = 0 THEN PRINT TAB(n / 2); "YY" ELSE PRINT TAB(n \ 2 + 1); "Y"
FOR i = FIX(n / 2 + 1.5) TO n
IF n MOD 2 = 1 THEN PRINT TAB(n \ 2 + 1); "Y"
IF n MOD 2 = 0 THEN PRINT TAB(n / 2); "YY"
NEXT i
CASE "Z"
PRINT STRING$(n, "Z")
FOR i = 2 TO n - 1
PRINT TAB(n + 1 - i); "Z"
NEXT i
PRINT STRING$(n, "Z")
CASE ELSE
PRINT "DATA ERROR!": SLEEP: CLS : GOTO 0
END SELECT
RETURN
输入:AB
5
输出(每输出一个超大字母按一次空格):
A
A A
AAAAA
A A
A A
BBBBB
B B
BBBBB
B B
BBBBB
输入:AB
7
输出:
A
A A
A A
AAAAAAA
A A
A A
A A
BBBBBBB
B B
B B
BBBBBBB
B B
B B
BBBBBBB
程序如下:
CLS
0 INPUT a$
DO
INPUT n
LOOP UNTIL n > 4
FOR q = 1 TO LEN(a$)
n$ = MID$(a$, q, 1)
GOSUB Zh
SLEEP
NEXT q
END
Zh:
SELECT CASE n$
CASE "A"
PRINT TAB(n); "A"
FOR i = 2 TO n
PRINT TAB(n + 1 - i);
IF i <> FIX(n / 2 + .5) THEN
PRINT "A"; SPC((i - 1) * 2 - 1); "A"
ELSE
PRINT STRING$((i - 1) * 2 + 1, "A")
END IF
NEXT i
CASE "B"
FOR i = 1 TO 2
PRINT STRING$(n, "B")
x = n
FOR j = 1 TO (n - 3) \ 2
IF ((n - 3) \ 2) MOD 2 = 0 AND j = (n - 3) \ 2 \ 2 + 1 THEN 1
IF j > (n - 3) \ 2 \ 2 + 1 THEN x = x - 1 ELSE x = x + 1
1 PRINT "B"; TAB(x); "B"
NEXT j
NEXT i
PRINT STRING$(n, "B")
CASE "C"
PRINT SPC(FIX(n / 2 - .5)); STRING$(n, "C")
x = FIX(n / 2 + .5)
FOR i = 2 TO n - 1
IF i > FIX(n / 2 + .5) THEN x = x + 1 ELSE x = x - 1
PRINT TAB(x); "C"
NEXT i
PRINT TAB(FIX(n / 2 + .5)); STRING$(n, "C")
CASE "D"
PRINT STRING$(n, "D")
x = n
FOR i = 2 TO n - 1
PRINT "D";
IF i > FIX(n / 2 + .5) THEN x = x - 1 ELSE x = x + 1
PRINT TAB(x); "D"
NEXT i
PRINT STRING$(n, "D")
CASE "E"
FOR i = 1 TO 2
PRINT STRING$(n, "E")
FOR j = 1 TO FIX(n / 2 - 1.5)
PRINT "E"
NEXT j, i
PRINT STRING$(n, "E")
CASE "F"
FOR i = 1 TO 2
PRINT STRING$(n + 1, "F")
FOR j = 1 TO FIX(n / 2 - 1.5)
PRINT "F"
NEXT j, i
PRINT "F"
CASE "G"
PRINT SPC(FIX(n / 2 - .5)); STRING$(n, "G")
x = FIX(n / 2 + .5)
FOR i = 2 TO FIX(n / 2 - .5)
x = x - 1
PRINT TAB(x); "G"
NEXT i
PRINT "G"; TAB(n); STRING$(FIX(n / 2 + .5), "G")
FOR i = FIX(n / 2 + 1.5) TO n - 1
x = x + 1
PRINT TAB(x - 1); "G"; TAB(n + FIX(n / 2 - .5)); "G"
NEXT i
PRINT SPC(FIX(n / 2 - .5)); STRING$(n, "G")
CASE "H"
FOR i = 1 TO n
IF i <> FIX(n / 2 + .5) THEN
PRINT "H"; TAB(n); "H"
ELSE
PRINT STRING$(n, "H")
END IF
NEXT i
CASE "I"
PRINT STRING$(n, "I")
FOR i = 2 TO n - 1
PRINT TAB(FIX(n / 2 + .5)); "I"
NEXT i
PRINT STRING$(n, "I")
CASE "J"
PRINT STRING$(n, "J")
FOR i = 1 TO FIX(n / 2 - .5)
PRINT TAB(FIX(n / 2 + .5)); "J"
NEXT i
FOR i = 1 TO n \ 2 - ABS((n \ 2) MOD 2 = 1)
PRINT "J"; TAB(FIX(n / 2 + .5)); "J"
NEXT i
PRINT " " + STRING$(FIX(n / 2 - 1.5), "J")
CASE "K"
x = n - (n \ 2 - 2)
FOR i = 1 TO n
IF i > FIX(n / 2 + .5) THEN x = x + 1 ELSE x = x - 1
PRINT "K"; TAB(x); "KK"
NEXT i
CASE "L"
FOR i = 1 TO n - 1
PRINT "L"
NEXT i
PRINT STRING$(n, "L")
CASE "M"
PRINT "M"; TAB(n * 2 - 1); "M"
x = 1
FOR i = 2 TO n - 1
x = x + 1
PRINT "M"; TAB(x); "M"; TAB(n * 2 - x); "M";
PRINT TAB(n * 2 - 1); "M"
NEXT i
PRINT "M"; TAB(FIX((n * 2 - 1) / 2 + .5)); "M"; TAB(n * 2 - 1); "M";
CASE "N"
PRINT "N"; TAB(n); "N"
x = 1
FOR i = 2 TO n - 1
x = x + 1
PRINT "N"; TAB(x); "N"; TAB(n); "N"
NEXT i
PRINT "N"; TAB(n); "N"
CASE "O"
x = FIX(n / 2 + .5)
PRINT TAB(x); STRING$(n - 1, "O")
y = x + n - 2
IF n MOD 2 = 0 THEN z = n - 2 ELSE z = n - 1
FOR i = 2 TO z
IF i > FIX(n / 2 + .5) THEN
x = x + 1: y = y - 1
ELSE
x = x - 1: y = y + 1
END IF
PRINT TAB(x); "O"; TAB(y); "O"
NEXT i
PRINT TAB(FIX(n / 2 + .5)); STRING$(n - 1, "O")
CASE "P"
PRINT STRING$(n, "P")
x = n
FOR i = 1 TO (n - 3) \ 2
IF (n - 3) \ 2 MOD 2 = 0 AND i = (n - 3) \ 2 \ 2 + 1 THEN 2
IF i > (n - 3) \ 2 \ 2 + 1 THEN x = x - 1 ELSE x = x + 1
2 PRINT "P"; TAB(x); "P"
NEXT i
PRINT STRING$(n, "P")
FOR i = 1 TO FIX(n / 2 - .5)
PRINT "P"
NEXT i
CASE "Q"
x = FIX(n / 2 + .5)
PRINT TAB(x); STRING$(n - 1, "Q")
y = x + n - 2
IF n MOD 2 = 0 THEN z = n - 2 ELSE z = n - 1
FOR i = 2 TO z - 1
IF i > FIX(n / 2 + .5) THEN
x = x + 1: y = y - 1
ELSE
x = x - 1: y = y + 1
END IF
PRINT TAB(x); "Q"; TAB(y); "Q"
NEXT i
PRINT TAB(x + 1); "Q"; TAB(y - 2); "QQ"
PRINT TAB(FIX(n / 2 + .5)); STRING$(n, "Q")
x = n + FIX(n / 2 - .5)
FOR i = 1 TO FIX(n / 2 - 1.5)
x = x + 1
PRINT TAB(x); "Q"
NEXT i
CASE "R"
PRINT STRING$(n, "R")
x = n
FOR i = 1 TO (n - 3) \ 2
IF (n - 3) \ 2 MOD 2 = 0 AND i = (n - 3) \ 2 \ 2 + 1 THEN 3
IF i > (n - 3) \ 2 \ 2 + 1 THEN x = x - 1 ELSE x = x + 1
3 PRINT "R"; TAB(x); "R"
NEXT i
PRINT STRING$(n, "R"): x = 3
FOR i = 1 TO FIX(n / 2 - .5)
PRINT "R"; TAB(x); STRING$(n - 3, "R")
x = x + 1
NEXT i
CASE "S"
PRINT TAB(FIX(n / 2 - .5)); STRING$(n, "S")
x = FIX(n / 2 - .5)
FOR i = 1 TO (n - 3) \ 2
IF (n - 3) \ 2 MOD 2 = 0 AND i = (n - 3) \ 2 \ 2 + 1 THEN 4
IF i > (n - 3) \ 2 \ 2 + 1 THEN x = x + 1 ELSE x = x - 1
4 PRINT TAB(x); "S"
NEXT i
PRINT TAB(FIX(n / 2 - .5)); STRING$(n, "S")
x = n + FIX(n / 2 - 1.5)
FOR i = 1 TO (n - 3) \ 2
IF (n - 3) \ 2 MOD 2 = 0 AND i = (n - 3) \ 2 \ 2 + 1 THEN 5
IF i > (n - 3) \ 2 \ 2 + 1 THEN x = x - 1 ELSE x = x + 1
5 PRINT TAB(x); "S"
NEXT i
PRINT STRING$(n + FIX(n / 2 - 1.5), "S")
CASE "T"
PRINT STRING$(n, "T")
FOR i = 2 TO n
PRINT TAB(FIX(n / 2 + .5)); "T"
NEXT i
CASE "U"
FOR i = 1 TO n - 1
PRINT "U"; TAB(n); "U"
NEXT i
PRINT TAB(2); STRING$(n - 2, "U")
CASE "V"
FOR i = 1 TO n - FIX(n / 2 - .5)
PRINT "V"; TAB(n); "V"
NEXT i
x = 1
FOR i = n - FIX(n / 2 - .5) TO n - 2
x = x + 1
PRINT TAB(x); "V"; TAB(n + 1 - x); "V"
NEXT i
IF n MOD 2 = 1 THEN
PRINT TAB(n \ 2 + 1); "V"
ELSE
PRINT TAB(n / 2); "VV"
END IF
CASE "W"
FOR i = 1 TO n - FIX(n / 2 - .5)
PRINT "W"; TAB(n); "W"; TAB(n + n - 1); "W"
NEXT i
x = 1: y = n
FOR i = n - FIX(n / 2 - .5) TO n - 2
x = x + 1
y = y + 1
PRINT TAB(x); "W"; TAB(n + 1 - x); "W";
PRINT TAB(y); "W"; TAB(n * 2 - (y - n) - 1); "W"
NEXT i
IF n MOD 2 = 1 THEN
PRINT TAB(n \ 2 + 1); "W"; TAB(n + n \ 2); "W"
ELSE
PRINT TAB(n / 2); "WW"; TAB(n + n / 2 - 1); "WW"
END IF
CASE "X"
FOR i = 1 TO FIX(n / 2 - .5)
x = x + 1
PRINT TAB(x); "X"; TAB(n + 1 - x); "X"
NEXT i
IF n MOD 2 = 0 THEN
PRINT TAB(n / 2); "XX"
PRINT TAB(n / 2); "XX"
ELSE
PRINT TAB(n \ 2 + 1); "X"
END IF
x = FIX(n / 2 + .5)
IF n MOD 2 = 0 THEN p = n - 1 ELSE p = n
FOR i = FIX(n / 2 + 1.5) TO p
x = x - 1
PRINT TAB(x); "X"; TAB(n + 1 - x); "X"
NEXT i
CASE "Y"
FOR i = 1 TO FIX(n / 2 - .5)
x = x + 1
IF n MOD 2 = 1 THEN PRINT TAB(x); "Y"; TAB(n + 1 - x); "Y"
IF n MOD 2 = 0 THEN PRINT TAB(x); "YY"; TAB(n + 1 - x); "YY"
NEXT i
IF n MOD 2 = 0 THEN PRINT TAB(n / 2); "YY" ELSE PRINT TAB(n \ 2 + 1); "Y"
FOR i = FIX(n / 2 + 1.5) TO n
IF n MOD 2 = 1 THEN PRINT TAB(n \ 2 + 1); "Y"
IF n MOD 2 = 0 THEN PRINT TAB(n / 2); "YY"
NEXT i
CASE "Z"
PRINT STRING$(n, "Z")
FOR i = 2 TO n - 1
PRINT TAB(n + 1 - i); "Z"
NEXT i
PRINT STRING$(n, "Z")
CASE ELSE
PRINT "DATA ERROR!": SLEEP: CLS : GOTO 0
END SELECT
RETURN