C/C++ Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingC/C++ Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old July 11th, 2005, 11:07 PM
aRabidLunatic aRabidLunatic is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 2 aRabidLunatic User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 25 m 48 sec
Reputation Power: 0
Simple program for putting inputs in order

I'm trying to sort 5 different numbers that a user will input into ascending order. What I got so far is using order(), but this, as far as I know, only works on pairs of two. I got it to work for 4 numbers ( 2 pairs of 2) How can I make the fifth number work? Since there isn't a sixth number to make it a pair. Unless, the fifth number is paired to some kind of null value? Putting 0 for the sixth # didnt work, because the 0 will always go to the front. Any help?

Reply With Quote
  #2  
Old July 12th, 2005, 01:36 AM
B-Con's Avatar
B-Con B-Con is offline
:bcon: moderator
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Location: int main()
Posts: 351 B-Con User rank is Private First Class (20 - 50 Reputation Level)B-Con User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 2 Days 23 h 1 m 43 sec
Reputation Power: 4
Research the "Bubble Sort" algorithm. Basically, you sort items 1 and 2, then 2 and 3, then 3 and 4, then 4 and 5. Then you go back up to the top and move down one, sorting 2 and 3, 3 and 4, then 4 and 5. Then go back to the top and move down 2, sort 3 and 4, then 4 and 5. Then you're done.
__________________
Officially a member of the Itsacon fan club. Beer blasts are every friday at Viper_SB's house. I bring the chips.



Reply With Quote
  #3  
Old July 12th, 2005, 08:26 AM
aRabidLunatic aRabidLunatic is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 2 aRabidLunatic User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 25 m 48 sec
Reputation Power: 0
I coudn't figure out how to use that bubble, but I did manage to use the sort(). Works pretty well. Thanks anyways.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingC/C++ Help > Simple program for putting inputs in order


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT