呵呵大家也看到題目--基礎練習。我不會出的太難的,這道題的思路應該會比較多的 不過我也還沒開始做,希望大家積極參與哦。(最慘的就是只能加別人兩分,郁悶) 習題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