#include <stdio.h>//library
yg dibutuhkan
#include <stdlib.h>
void swapValue (int *tIntA, int
*tIntB);
int main() 
{
       int
tListAngka[20] = {1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2}; 
       int
tSwap; 
       int
tUrutan; 
       do 
       { 
              tSwap = 0; 
              for(tUrutan=0;tUrutan<19;tUrutan++)
              { 
              if(tListAngka[tUrutan]<tListAngka[tUrutan+1])
                     {
                     swapValue(&tListAngka[tUrutan],
&tListAngka[tUrutan+1]); 
                     tSwap = 1; 
                     } 
              } 
       } 
       while(tSwap
== 1); 
       for(tUrutan=0;tUrutan<20;tUrutan++)
       { 
              printf("Nilai
: %d,\n", tListAngka[tUrutan]); 
       } 
       system("pause");
} 
void swapValue (int *tIntA, int
*tIntB) 
{ 
       int tInt
= *tIntA;
       *tIntA = *tIntB;
       *tIntB = tInt; 
}
Vidionya dpt dilihat di: 
No comments:
Post a Comment