mine in your language

English French German Spain Italian Dutch Russian Portuguese Japanese Korean Arabic Chinese Simplified

Sabtu, 02 April 2011

contoh program quick sort c++

#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int sort_function(const void*a,const void*b);

char list[5][4]
={"cat","cab","cap","can","car"};
int main(void)
{
int x;
qsort((void*)list,5,sizeof(list[0]),sort_function);
for(x=0;x<5;x++)
printf("%s\n",list[x]);
return 0;
}
int sort_function(const void*a,const*b)
{
return(strcmp((char*)a,(char*)b));
}


Tidak ada komentar:

Posting Komentar

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
hostgator coupon code