呵呵大家也看到题目--基础练习。我不会出的太难的,这道题的思路应该会比较多的 不过我也还没开始做,希望大家积极参与哦。(最惨的就是只能加别人两分,郁闷) 习题1.1 字符串长度不超过80。不含特殊字符 例 i like the bathome,because here is the batch of the world. 1.2 字符串长度小于255,含有特殊字符,试求其长度。 例 %%a%%!ver!&^^^ ^*~ are you o k ?" : / / ` ` verfdxcweippo opj x ds gw !%% 一般的,先求1.1的题目。看谁的代码灵活、简洁、思路清晰。然后再做1.2
@echo off echo,i like the bathome,because here is the batch of the world.>x.x for /f "tokens=*" %%a in ('dir x.x /-c ^|find " 字节" ^|find /v ":"') do ( for /f "tokens=3" %%b in ('echo,%%a') do ( set /a n=%%b-2 call echo %%n%% del x.x ) ) pause>nul
shqf:
复制代码 代码如下:
::%%a%%!ver!&^^^ ^*~ are you o k ?" : / / ` ` verfdxcweippo opj x ds gw !%% @echo off&setlocal enabledelayedexpansion set /p str=<%0 for /l %%a in (1,1,255) do (set str=!str:~1!&if "!str!"=="" (set /a totle=%%a-2&echo !totle!&goto end)) :end pause
terse:
复制代码 代码如下:
@echo off&setlocal enabledelayedexpansion set/p str=Type : for /l %%i in (1,1,10000) do if "!str:~%%i,1!"=="" echo %%i&pause&exit