View Full Version : how to swap number in the fortran memory??
dadidudada
Dec13-11, 10:18 AM
hello..
im new to fortran so how i swap number in do loop
first the tracing is like this:
x(1)=3
x(2)=8
then, how to i can swap the number in x(1) and x(2)
can anyone help me
please...
Why would you not use;
a=x(1)
x(1)=x(2)
x(2)=a
?
dadidudada
Dec13-11, 10:48 AM
ok im completely blank..
if i have to arrange these number(10,4,1)into ascending order..
what should i do..
Run through each number (to n-1) in the list (of n numbers) and swap over any where x(a) > x(a+1). Repeat. Set up a flag so you can stop if none are swapped during a repeat.
dadidudada
Dec13-11, 10:01 PM
Run through each number (to n-1) in the list (of n numbers) and swap over any where x(a) > x(a+1). Repeat. Set up a flag so you can stop if none are swapped during a repeat.
thanks man!!!its solved..
credit to cmb...
vBulletin® v3.8.7, Copyright ©2000-2012, vBulletin Solutions, Inc.