Siemka Mam malutki problemik gdyż mam programik który sortuje tablice liczbową i chciałabym aby sortował tylko liczby 0 i 1
#include <iostream.h>#include <stdio.h> #include <conio.h>#include <stdlib.h>const int n=10;/*-----------------------------------------*/void qsort (int *tab, int lewy, int prawy);/*-----------------------------------------*/int main (void) { int tab[n], i; srand(time(0)); for (i=0; i<n; i++) { tab [i]=(1+rand()%100); } cout << "Przed sorotwaniem:\n\n"; for (i=0;i<n;i++) { cout << tab [i] << " "; } cout << "\n\n\nWcisnij ENTER by posortowac niemalejaco\n"; getchar(); cout << "\nPo sortowaniu:\n\n"; qsort (tab,0,n); for (i=0;i<n;i++) { cout << tab [i] << " "; } getchar();}void qsort (int *tab, int lewy, int prawy) { int v=tab[(lewy+prawy)/2]; int i,j,x; i=lewy; j=prawy; do { while (tab [i]<v) i++; while (tab[j]>v) j--; if (i<=j) { x=tab [i]; tab [i]=tab[j]; tab[j]=x; i++; j--; } } while (i<=j); if (j>lewy) qsort(tab,lewy, j); if (i<prawy) qsort(tab, i, prawy); }