// sortowanieszybkie.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include #include #include #include int LICZNIK=0; void szybkiesortowanie (int* tab, int ile) { int pivot; int gdziepivot; LICZNIK++; gdziepivot = (ile) / 2 ; int p=ile-1; int l=0; int pamietaj; pivot = tab[gdziepivot]; while (1) { while ( tab[l] < pivot ) { l++; } while ( tab[p] > pivot ) { p--; } if (l <= p) { pamietaj = tab[p]; tab[p] = tab[l]; tab[l] = pamietaj; l++; p--; } else { break; } } if (p > 0) { szybkiesortowanie (tab, p+1); } if (l < ile-1) { szybkiesortowanie ((int *)&tab[l], ile-l); } LICZNIK--; } int _tmain(int argc, _TCHAR* argv[]) { int ile; int* tablica; srand (time(NULL)); printf ("ile liczb?\n"); scanf ("%d",&ile); tablica = (int*) malloc (sizeof (int) * ile); while (1) { puts("liczby\n"); for (int i=0; i