Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 sorting an array
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
soulgnat




PostPosted: Fri Jan 09, 2004 8:38 pm   Post subject: sorting an array

i've gotten codes before about sortin an array such as

for i:1..upper(names)-1
for j:i+1,upper(names)
if names(j)<names(i) then
temp:=names(j)
names(j):=names(i)
names(i):=temp
end if
end for
end for

but i want random numbers entered by user to be sorted in an ascending order..could someone give me the code and explain it to me? i know you have to compare and use the if structure, but im not clear on it..thanx so much peeps
Sponsor
Sponsor
Sponsor
sponsor
Andy




PostPosted: Fri Jan 09, 2004 9:16 pm   Post subject: (No subject)

what you do is have a for loop to save the data inputted by the user into an array then sort it using the method u posted... unless i misunderstood u
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: