标题: [总结]交换两个数的值
[打印本页]
作者: s11ss
时间: 2008-11-8 22:09
标题: [总结]交换两个数的值
@echo off&setlocal
:c
set x1=100
set x2=200
set/ai+=1
if %i% leq 4 echo x1:%x1% x2:%x2%&call:c%i% x1 x2&call echo x1:%%x1%% x2:%%x2%%&echo.&goto:c
pause
exit/b
:c1
call set a=%%%1%%&call set b=%%%2%%
set a=%b%&set b=%a%
set %1=%a%&set %2=%b%
goto:eof
:c2
set/a%1+=%2,%2=%1-%2,%1-=%2
goto:eof
:c3
set/a%1^^=%2,%2^^=%1,%1^^=%2
goto:eof
:c4
set/at=%1,%1=%2,%2=t
goto:eof
[
Last edited by s11ss on 2008-11-8 at 23:44 ]
作者: HAT
时间: 2008-11-8 22:22
凑个热闹
@echo off
set x1=100
set x2=200
set /a x1=x2+(x2=x1)*0
echo %x1%
echo %x2%
pause
作者: s11ss
时间: 2008-11-8 22:31
牛