There is a group of characters: 13 z 113 -3 778 10004 f k a 119 -101 8 -19 m
Requirement: Sort and output through batch processing: -101 -19 -3 8 13 113 119 778 10004 a f k m z
Try to use the method of not generating temporary files as much as possible.
PS: For the first new person who makes it, I will add 15 points.
----------------------------------------------------------------------------------------------------------
My answer:
[ Last edited by zw19750516 on 2008-5-21 at 08:19 PM ]
Requirement: Sort and output through batch processing: -101 -19 -3 8 13 113 119 778 10004 a f k m z
Try to use the method of not generating temporary files as much as possible.
PS: For the first new person who makes it, I will add 15 points.
----------------------------------------------------------------------------------------------------------
My answer:
@echo off&setlocal enabledelayedexpansion
set str=13 z 113 -3 778 10004 f k a 119 -101 8 -19 m
echo Before sorting: %str%
for %%i in (%str%) do call,set var=!var! #%%i#
for %%i in (%var%) do set a=%%i&call :lp
echo After sorting: %var:#=%
pause>nul&goto :eof
:lp
for %%i in (%var%) do (
set b=%%i&set b=!b:#=!&set c=!a:#=!
if !b! lss !c! (
set var=!var:%a% =!
set var=!var:%%i=%%i %a%!
) else (
set var=!var!
)
)
[ Last edited by zw19750516 on 2008-5-21 at 08:19 PM ]
批处理之家新域名:www.bathome.net
