I don't know how to translate the bubble sort program in DOS

March 22, 2012 at 08:05:57
Specs: Windows XP
Could you please help me make a bubble sort program in DOS.

See More: I dont know how to translate the bubble sort program in DOS

Report •

March 22, 2012 at 15:13:28
In BASIC or any other language rather easy just move the largest item up the array repeatedly.

Report •

March 22, 2012 at 16:31:49
yeah. i know how to make a bubble sort program in C. I just want it translated in DOS but I don't know the right syntax. If you could give me the source code in DOS i'll be very grateful.

Report •

March 22, 2012 at 19:49:51
You need a C compiler that makes DOS compatible exe's. Maybe Turbo C. The code can be the same except for headers.

Report •

Related Solutions

July 10, 2013 at 15:52:43
DOS is an Operating System, that is what the OS bit stands for.

To make a bubble sort you need a programming language which DOS is not.

I suspect the OP wants a batch routine running from the Command Prompt which some have this mistaken idea is DOS just because it has a prompt similar to DOS.


Report •

July 11, 2013 at 12:27:58
Here's a batch (not DOS, ha ha!) sorter. It's kind of cludgy, but that's batch for ya. I left in the intermediate displays for more graphic demonstration:
::===== begin batch bsort.bat

@echo off & setlocal enabledelayedexpansion
set c=-1
for /f %%a in (unsort) do (
set /a c+=1
set a!c!=%%a
echo initial:
call :disp

for /L %%a in (%c%,-1,1) do call :xx %%a
echo final:
call :disp
goto :eof

echo level %1
set k=0
call :disp
set /a b=k+1

echo k: %k% ak:!a%k%! ab:!a%b%!

if !a%k%! gtr !a%b%! (
set h=!a%k%!
set a%k%=!a%b%!
set a%b%=!h!
set /a k+=1
echo incremented k: %k% of %1
if %k% lss %1 goto :xxx
goto :eof

for /L %%a in (0,1,%c%) do echo %%a !a%%a!
echo ------

Report •

Ask Question