原来有这么搞代码了 先前用笨办法写的 到第二边的时候定义 后面用它- @echo off&setlocal enabledelayedexpansion&color a
- set/p n=请输入边长(最大37)
- set/a n1=n-2,n2=n*2-3,n3=76-n*2
- if %n3% leq 0 echo 输入超出范围&pause&exit
- mode con cols=80 lines=40
- for /l %%i in (1 1 79) do set "f= !f!"
- for /l %%i in (1 1 %n%) do (
- set "c=* !c!"
- set/a t=%%i*2
- call echo !f:~,5!%%c:~,!t!%%
- for /l %%a in (1,1,200) do echo.>nul
- cls
- )
- set str=!f:~,5!!c:~,-1!
- if %n1% gtr 0 (
- for /l %%i in (1 1 %n1%) do (
- set/a x=n-%%i-1
- set b!x!=!f:~,5!!c:~,-1!!var!
- set var=!var!!f!*
- set str=!f:~,5!*!f:~,%n2%!*!f:~,%n3%!!str!
- set a%%i=!str!
- echo !f:~,5!!c:~,-1!!var!!f!
- for /l %%a in (1,1,200) do echo.>nul
- cls
- ))
- for /l %%i in (1 1 %n%) do (
- cls
- set/a t=%%i*2
- call echo !f:~,5!!c:~,-1!!var! %%f:~,-!t!%%%%c:~-!t!%%
- for /l %%a in (1,1,200) do echo.>nul
-
- )
- if %n1% gtr 0 (
- for /l %%i in (1 1 %n1%) do (
- cls
- echo !b%%i!
- echo !a%%i!
- for /l %%a in (1,1,200) do echo.>nul
- ))
- pause>nul
复制代码
|