
-----------------------------------
soulgnat
Wed Jan 07, 2004 8:27 pm

arranging numbers in ascending order
-----------------------------------
how do you arrange numbers in ascending order? is there a set piece of code that i can use? thanx

-----------------------------------
Skizzarz
Wed Jan 07, 2004 8:31 pm


-----------------------------------
u mean like:

var num : int := 0
loop
put num
num := num + 1
delay (200)
end loop

-----------------------------------
Skizzarz
Wed Jan 07, 2004 8:33 pm


-----------------------------------
or do u mean like have the user enter some numbers and you arrange them from smallest to biggest?

-----------------------------------
soulgnat
Wed Jan 07, 2004 8:40 pm

wrong code
-----------------------------------
what do you mean? the code? what does ur code exactly do? the code i was asking about was about when the user enters random numbers, you arrange the entered numbers in ascending order..how do you do that?

-----------------------------------
Maverick
Wed Jan 07, 2004 8:48 pm


-----------------------------------
Yes, they do.
If your sorting random numbers then...

var number:array 1..20 of int
var num,temp:int

%load array with random integers from 0 to 100
for i:1..20
  randint(num,0,100)
  number(i):=num
end for

%sort array in ascending order
for i:1..20
  for y:1..19
     if number(y)>=number(y+1) then% num2 and num1 > num3 and num2 < num1 and num3 < num1 and num2 < num3 then
cls
put "Numbers Ascending!"
put num2
put num3
put num1
end if

Makes logical sense right, but very time consuming. Once you finish the ascending statements, you could just copy and paste the entire code and use common sense to set it up for descending statements.

-----------------------------------
master-awesome
Sun Nov 23, 2014 8:12 pm

Re: arranging numbers in ascending order
-----------------------------------
how do you arrange numbers in ascending order? is there a set piece of code that i can use? thanx

There is just one major flaw in this program! It can't read equal numbers!
