
批處理選擇排序法中的set命令是什么意思
請(qǐng)問(wèn)這行“set str=!str! !a_%%i!”命令中的“!str! !a_%%i!”是什么意思啊 ?為什么有2個(gè)變量沒(méi)用其他運(yùn)算符,而是空格nclick="copycode($('code0'));">復(fù)制代碼
- @echo off
- setlocal enabledelayedexpansion
- ::選擇排序法
- echo 共輸入10個(gè)數(shù)
- for /l %%i in (1,1,10) do (
- set /p a_%%i=請(qǐng)輸入%%i個(gè)數(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

