![]() |
|
#1
|
|||
|
|||
Another bubble sort, can't get past the 1st passI am trying to complete this bubble sort in which all the elements of the array are printed after each pass..
CPP / C++ / C Code:
It works fine now with no errors and here is what I get: Unordered data: 7 3 66 3 -5 22 -77 2 After pass 1: -77 7 66 3 3 22 -5 2 Here is what I would like to see: Unordered data: 7 3 66 3 -5 22 -77 2 After pass 1: -77 7 66 3 3 22 -5 2 After pass 2: -77 -5 66 7 3 22 3 2 After pass 3: And so on... So what do I need to change/impliment to get this to keep going and printing after every pass? It seems simple, but I'm tired and need some fresh eyes to help me out. Thanks! SRTeasy |
|||
|
#2
|
|||
|
|||
Re: Another bubble sort, can't get past the 1st passQuote:
CPP / C++ / C Code:
Quote:
Use some other variable for the print loop above, since it makes go to n, so the outer loop is finished after one time through. Regards, Dave |
|
#3
|
|||
|
|||
Re: Another bubble sort, can't get past the 1st passUse another variable besides 'i' or 'n'? and what should that variable be declared?
Thanks for the help thus far, I am working on it.. |
|
#4
|
|||
|
|||
Re: Another bubble sort, can't get past the 1st passAHHHH! I got it.. thanks for your help!
|
Recent GIDBlog
Problems with the Navy (Enlisted) by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to sort in C++ alphabetically | wilen | C++ Forum | 5 | 20-Apr-2007 14:43 |
| Sort an array of structures | sassy99 | C Programming Language | 10 | 15-Feb-2007 07:46 |
| Bubble Sorts with 2d Arrays | y2l | C Programming Language | 5 | 14-Apr-2006 13:01 |
| help with Bubble sort program that uses vectors instead of arrays | sasuke101 | C++ Forum | 9 | 25-Oct-2005 11:26 |
| need help with bubble sort for c++ | sasuke101 | C++ Forum | 2 | 21-Sep-2005 20:12 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The