出題目的 1 掌握大、小寫互換的技巧 2 掌握延時輸出技巧 3 掌握字符截取技巧 解題要求 1 確保代碼高效、通用 2 盡量簡潔代碼 3 不生成臨時文件 加分規則 1 思路獨特基準分5分 2 代碼高效、通用基準分4分 3 技巧高超基準分3分 4 代碼簡潔基準分2分 5 完美代碼加分15分 題目如下 有一字符串i like the bathome,because here is the batch of the world. 要求用批處理將字符串的所有字母轉成大寫并在屏幕上以打字的效果延時輸出。 解題限制 暫無限制
batman:
復制代碼 代碼如下:
@echo off set "str=i like the bathome,because here is the batch of the world." set "code=A B C D E F G H I J K L N M O P Q R S T U V W X Y Z" for %%i in (%code%) do call,set "str=%%str:%%i=%%i%%" :lp set /p=%str:~,1%<nul&set "str=%str:~1%" for /l %%i in (1,1,200) do echo>nul if defined str goto lp pause>nul
terse:
復制代碼 代碼如下:
@echo off&setlocal EnableDelayedExpansion set "str=i like the bathome,because here is the batch of the world." for %%i in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do set str=!str:%%i=%%i! :lp set/p=!str:~%n%,1!<nul set/a n+=1 for /l %%j in (1,1,500) do ver>nul if not "!str:~%n%,1!"=="" goto lp pause>nul