Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Echo Off
- ::Ordenamiento Burbuja
- ::Coded by SmartGenius
- Setlocal EnableDelayedExpansion
- If ["%~1"]==[""] Echo. No Parameters&Exit /b 1
- :Input
- Set /a "C+=1"
- Set "P%C%=%~1"
- Shift
- If ["%~1"]==[""] (
- If Not 1 EQU %C% (
- Goto :Sort
- ) Else (
- Echo. %P1%
- Exit /b 0
- ))
- Goto :Input
- :Sort
- Set /a "N=C","Ni=C-1"
- For /l %%I in (2,1,%N%) do (
- For /l %%J in (1,1,%Ni%) do (
- Set /a "Ji=%%J+1"
- Call Set "Pk=%%P!Ji!%%"
- If !P%%J! GTR !Pk! (
- Set "T=!P%%J!"
- Set "P%%J=!Pk!"
- Set "P!Ji!=!T!"
- )))
- Echo. Salida
- For /l %%C in (1,1,%C%) do (Echo. !P%%C!)
- Exit /b 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement