呵呵大家也看到題目--基礎(chǔ)練習(xí)。我不會(huì)出的太難的,這道題的思路應(yīng)該會(huì)比較多的 不過(guò)我也還沒(méi)開(kāi)始做,希望大家積極參與哦。(最慘的就是只能加別人兩分,郁悶) 習(xí)題1.1 字符串長(zhǎng)度不超過(guò)80。不含特殊字符 例 i like the bathome,because here is the batch of the world. 1.2 字符串長(zhǎng)度小于255,含有特殊字符,試求其長(zhǎng)度。 例 %%a%%!ver!&^^^ ^*~ are you o k ?" : / / ` ` verfdxcweippo opj x ds gw !%% 一般的,先求1.1的題目。看誰(shuí)的代碼靈活、簡(jiǎn)潔、思路清晰。然后再做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 " 字節(jié)" ^|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:
復(fù)制代碼 代碼如下:
::%%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:
復(fù)制代碼 代碼如下:
@echo off&setlocal enabledelayedexpansion set/p str=Type : for /l %%i in (1,1,10000) do if "!str:~%%i,1!"=="" echo %%i&pause&exit