批處理選擇排序法中的set命令是什么意思請問這行“set str=!str! !a_%%i!”命令中的“!str! !a_%%i!”是什么意思啊 ?為什么有2個變量沒用其他運算符,而是空格nclick="copycode($('code0'));">復(fù)制代碼
- @echo off
- setlocal enabledelayedexpansion
- ::選擇排序法
- echo 共輸入10個數(shù)
- for /l %%i in (1,1,10) do (
- set /p a_%%i=請輸入%%i個數(shù)
- set str=!str! !a_%%i!
- )
- echo %str%
- for /l %%i in (1,1,10) do (
- set /a b=%%i+1
- for /l %%j in (!b!,1,10) do (
- if !a_%%i! gtr !a_%%j! (
- set /a t=a_%%i
- set /a a_%%i=a_%%j
- set /a a_%%j=t
- )
- )
- )
- for /l %%i in (1,1,10) do (
- set str1=!str1! !a_%%i!
- )
- echo %str1%
- pause>nul