| eselar (1) | |
|
Hey everyone, I'm sorting an array randomly populated with the numbers 1-52 from least to greatest using multiple sorting algorithms, right now I still cant get my bubble sort to behave after i run the bubble sort, i print the elements; every element contains an assortment of characters like A0DDF288 There must be something wrong with my bubble sort void BubbleSort() { int count=52; bool moved; do { moved=false; for ( int i = 0; i < count; i++ ) { if ( bubbleCards[i] > bubbleCards[i+1] ) { int temp = bubbleCards[i]; bubbleCards[i] = bubbleCards[i+1]; bubbleCards[i+1] = temp; bubbleSwap++; moved=true; } bubbleComp++; } count--; } while (moved); return; } FYI there are no parameters to this function because i simply defined it outside of main to look neat any pointers would be helpful :) | |
|
|
|