How to swap variables of type char..?

Dec 4, 2013 at 4:47am
How to swap variables of type char..?

qtyOnHand is type int
isbn and bookTitle is type char

not getting correct output for isbn and booktitle please help

1
2
3
4
5
6
7
8
9
10
11
12
 for(int x=0; x < 20-1; x++){
             for (int y=0; y<20; y++){
                     if (qtyOnHand[y]<qtyOnHand[y+1]){
                         swap = qtyOnHand[y+1];
                         qtyOnHand[y+1] = qtyOnHand[y];
                         qtyOnHand[y] = swap;
                         std::swap (isbn[y+1][14],isbn[y][14]);
                         std::swap (bookTitle[y+1][51],bookTitle[y][51]);
                         
                     }
             } 
      }     


not getting the correct output
Last edited on Dec 4, 2013 at 5:37am
Dec 4, 2013 at 6:11am
basically how to bubble sort arrays of type char *.*
Topic archived. No new replies allowed.