批处理之家's Archiver

悬崖之树 发表于 2013-2-7 19:17

批处理输出如下图形--闪电

[attach]6099[/attach][attach]6099[/attach]

答案暂时不公布

CrLf 发表于 2013-2-8 02:30

[code]@echo off&setlocal enabledelayedexpansion
for /l %%a in (1 1 11) do set "空格=!空格! "&set "星号=!星号!*"
for /l %%a in (1 1 10) do echo !空格:~%%a!!空格:~%%a!!星号:~,%%a!
for /l %%a in (10 -1 1) do echo !空格:~-%%a!!星号:~-%%a!
pause
[/code]

763244966 发表于 2018-4-26 17:58

[code]
@echo off

setlocal enabledelayedexpansion
:: 初始化满值空格和星星
for /l %%i in (1, 1, 10) do (
    set "spaceStr=!spaceStr! "
    set "starStr=!starStr!*"
)

:: 循环输出
for /l %%i in (1, 1, 10) do (
    echo   !spaceStr:~%%i!!spaceStr:~%%i!!starStr:~,%%i!
)
for /l %%j in (1, 1, 10) do (
    echo !spaceStr:~%%j!!starStr:~%%j!
)

endlocal
[/code]

懒虫阿布 发表于 2018-7-22 18:38

[code]@echo off
setlocal enabledelayedexpansion
for /l %%i in (1,1,20) do (
        set starstr=!starstr!*
        set spacestr= !spacestr!
)

set spacelen=20
set starlen=1
:STARTLOOP
if !starlen! GTR 10 goto LOOPEND
echo !spacestr:~1,%spacelen%! !starstr:~0,%starlen%!
set /a spacelen=!spacelen!-2
set /a starlen=!starlen!+1
goto STARTLOOP
:LOOPEND
set spacelen=9
set starlen=10
:STARTLOOP2
if !starlen! LSS 1 goto LOOPEND2
echo !spacestr:~1,%spacelen%! !starstr:~0,%starlen%!
set /a spacelen=!spacelen!-1
set /a starlen=!starlen!-1
goto STARTLOOP2
:LOOPEND2[/code]

页: [1]

Powered by Discuz! Archiver 7.2  © 2001-2009 Comsenz Inc.