1. //冒泡排序  
  2. void sortBubble(int t[],int size,int style)  
  3. {  
  4.     //style:1升序  
  5.     int temp = 0;  
  6.     int x;  
  7.     for (int m=0;m<size;m++)  
  8.     {  
  9.         for (int n=m+1;n<size;n++)  
  10.         {  
  11.             temp = t[m];  
  12.             if (1 == style)  
  13.             {  
  14.                 if (temp>t[n])  
  15.                 {  
  16.                     x = temp;  
  17.                     t[m] = t[n];  
  18.                     t[n] = x;  
  19.                 }  
  20.             }  
  21.             else 
  22.             {  
  23.                 if (temp<t[n])  
  24.                 {  
  25.                     x = temp;  
  26.                     t[m] = t[n];  
  27.                     t[n] = x;  
  28.                 }  
  29.             }  
  30.           
  31.         }  
  32.     }