欢迎帖码,语言不限。复制代码
- @echo off
- set "str= ******************************************"
- for /l %%i in (1,1,38) do (
- call,echo,%%str:~%%i,%%i%%
- )
- set/p=
复制代码
- >>> print(''.join([('*'*r).center(17,'-')+"\n" for r in range(1,18,2)]))
- --------*--------
- -------***-------
- ------*****------
- -----*******-----
- ----*********----
- ---***********---
- --*************--
- -***************-
- *****************
复制代码
- $n=9;1..$n|%{' '*($n-$_)+'*'*(2*$_-1)}
复制代码
- @echo off & setlocal EnableDelayedExpansion
- set max=78
- for /l %%$ in (1 1 10) do (
- set a=!a!**
- call :zhong !a!
- )
- pause
- :zhong
- set s=%1
- for /l %%# in (1,2,!max!) do if "!s:~%max%,1!" == "" set "s= !s! "
- set s=!s:~1,%max%!& echo;!s!
- exit /b
复制代码
- @echo off
- Setlocal enabledelayedexpansion
- ::CODER BY Old.Liu POWERD BY iBAT
- set /p long=Input:
- set /a long=long/2
- set /a long=long*2+1
- set /a half=long/2
- set /a i=1
- for /l %%a in (1 1 !half!) do set/p= <nul
- for /l %%a in (1 1 !i!) do set/p=*<nul
- echo.
- if !long! == 1 goto end
- :loop
- set /a i+=2
- set /a half-=1
- for /l %%a in (1 1 !half!) do set/p= <nul
- for /l %%a in (1 1 !i!) do set/p=*<nul
- echo.
- if "!i!" equ "!long!" goto end
- goto loop
- :end
- pause
复制代码
- @echo off&setlocal enabledelayedexpansion
- set "kong="
- for /l %%a in (1,1,17) do set "kong=!kong! "
- set "s=*"
- for /l %%a in (1,1,17) do (
- echo !kong!!s!
- set "kong=!kong:~1!"
- set "s=!s!**!
- )
- pause
复制代码
- @set s= *
- :r
- @echo;%s%&if "%s:~0,1%"==" " set s=%s:~1%%s:~-1%%s:~-1%&goto :r
- @pause
复制代码
- @set s= *
- :r
- @echo(%s%&if %s:~,1%*==* set s=%s:~1%**&goto:r
- @pause
复制代码
- @set s= O
- :O
- @echo;%s%&set s=%s:~1%OO&goto%s:~,2%O
- :OO
- pause
复制代码
- my $floor = 5;
- my $s = " "x$floor;
- my @line;
- for my $n ( 0 .. $floor-1 )
- {
- $s=~s/ /*/;
- $line[$n] = $s;
- }
- for my $n ( $floor .. $floor*$floor - 1 )
- {
- $line[$n] = $line[$n%$floor] x ($n/$floor+1);
- }
- print join("\n", @line);
*
**
***
****
*****
* *
** **
*** ***
**** ****
**********
* * *
** ** **
*** *** ***
**** **** ****
***************
* * * *
** ** ** **
*** *** *** ***
**** **** **** ****
********************
* * * * *
** ** ** ** **
*** *** *** *** ***
**** **** **** **** ****
*************************
复制代码
- @echo off
- Setlocal enabledelayedexpansion
- ::CODER BY Old.Liu POWERD BY iBAT
- set /p long=Input:
- set /a long=long/2
- set /a long=long*2+1
- set /a half=long/2
- set /a i=1
- set a=.
- for /l %%a in (1 1 !half!) do set "a=!a! "
- for /l %%a in (1 1 !i!) do set a=!a!*
- echo!a!
- if !long! == 1 goto end
- :loop
- set /a i+=2
- set /a half-=1
- set a=.
- for /l %%a in (1 1 !half!) do set "a=!a! "
- for /l %%a in (1 1 !i!) do set a=!a!*
- echo!a!
- if "!i!" equ "!long!" goto end
- goto loop
- :end
- pause
复制代码
- my @lines = "*";
- func( \@lines, 1 );
- sub func
- {
- my ($ref, $lv) = (shift, shift);
- my @tri;
- my $top = $#$ref + 1;
- grep { push @tri, "$_ $_" } @$ref;
- grep { unshift @tri, " "x$top .$_ ." "x$top } ( reverse @$ref );
- ( $lv <= 3 ) ?
- func( \@tri, $lv+1 ) : print join("\n", @tri);
- }
复制代码
- *
- * *
- * *
- * * * *
- * *
- * * * *
- * * * *
- * * * * * * * *
- * *
- * * * *
- * * * *
- * * * * * * * *
- * * * *
- * * * * * * * *
- * * * * * * * *
- * * * * * * * * * * * * * * * *
复制代码
- @echo off&setlocal enabledelayedexpansion
- set level=4
- set /a n=100000000,m=1
- for /l %%a in (1 1 %level%) do set /a m*=2
- set /a a=n+2*m,aa=m-1+n,m=n+m
- for /l %%a in (%n% 1 %a%) do set "#%%a= "
- set #%m%=*
- for /l %%a in (%n% 1 %aa%) do (
- set "s="&set r=*
- for /f "tokens=1* delims==" %%b in ('set #') do set "s=!s!%%c"
- echo;!s!
- set /a b=m-%%a+n,c=m+%%a-n
- for /l %%c in (!b! 1 !c!) do (
- set /a d=%%c-1,e=%%c+1,h=c+1
- for %%i in (!d!) do set f=!#%%i!
- for %%j in (!e!) do set g=!#%%j!
- if "!f!" neq "!g!" (set t=*) else set "t= "
- for %%i in (!d!) do set #%%i=!r!
- set r=!t!
- )
- set #!c!=!t!&set #!h!=*
- )
- pause
复制代码
- '&@(cls&Echo off 2>nul 3>nul)
- '&set /p long=输入长度:
- '&set /p floor=输入层数:
- '&Cscript -nologo -e:vbscript "%~0" "%floor%" "%Long%"
- '&Pause&Exit
- floor_=WScript.Arguments(0)
- long_=WScript.Arguments(1)
- For a = 1 To floor_
- For i = 1 To long_
- For b = 1 To a
- For j = 1 To i
- Echo=Echo&"*"
- Next
- For j = i To long_
- Echo=Echo&" "
- Next
- Next
- Echo=Echo&vbNewLine
- Next
- Next
- WScript.Echo echo
复制代码
- @echo off
- mode con cols=300 lines=80
- setlocal enabledelayedexpansion
- set "Space= "
- set/a "L=(1<<7)-1"
- for /l %%i in (0,1,!L!) do (
- set/a "1/(%%i&1)" 2>NUL || (
- set/a "SL=(L-%%i)>>1"
- for %%j in (!SL!) do (
- set "PreSpace=!Space:~0,%%j!"
- )
- for /l %%j in (0,1,!L!) do (
- set/a "1/((%%i&%%j)-%%j)" 2>NUL && (
- set "PreSpace=!PreSpace! "
- ) || (
- set "PreSpace=!PreSpace!*"
- )
- )
- echo;!PreSpace!
- )
- )
- set/p=LEVEL: 7
复制代码
- @echo off & setlocal enabledelayedexpansion
- set /a "w=80,h=35,t=w*h,xc=w/2,yc=h/2"
- mode %w%,40
- for /l %%i in (1 1 !t!) do set "s=!s! "
- call :f 0 -16 32 s
- echo;!s! &pause &exit
- :f xtop ytop hei s
- REM 半顶角对边与底角对边比: 1:1 , hei <= 1, 绘 3 点, 否则递归
- setlocal
- set "s=!%4!"
- if %3 leq 1 (
- set /a "a=%1 - 1, d=b=%2 + 1, c= %1 + 1"
- call :d %1 %2 & call :d !a! !b! & call :d !c! !d!
- ) else (
- set /a "h=%3 >> 1, a= %1 - h, d=b=%2 + h, c= %1 + h"
- call :f %1 %2 !h! %4 & call :f !a! !b! !h! %4 & call :f !c! !d! !h! %4
- )
- (
- endlocal
- set "%4=%s%"
- exit /b
- )
- :d
- set /a "i=%1-xc + (%2-yc) * w + 1, L=i-1"
- for /f "tokens=1,2" %%a in ("!L! !i!") do (set s=!s:~0,%%a!*!s:~%%b!)
- exit /b
欢迎光临 批处理之家 (http://bbs.bathome.net/) | Powered by Discuz! 7.2 |