Cześć. Napisałam taki program, ale wyskakuję mi błąd, niestety pomiomo usilnych poszukiwań nie znalazłam go. Mógłby ktoś spojrzeć i zobaczyć co zrobiłam nie tak i napisać mi poproszę. Z góry dziękuję bardzo.
#include <iostream>
#include <time.h>
using namespace std;
int sort_w();
int sort_w(){
int n;
int tab[n];
int bufor;
int i ;
srand(time(NULL));
n=(rand()%10+1);
for (i=0; i<n; i++)
tab[i]=(rand()%100+1);
for (int i=1; i<n; i++)
{
for (int z=n-1; z>=1; z--)
{
if (tab[z]>tab[z-1])
{
bufor=tab[z];
tab[z]=tab[z-1];
tab[z-1]=bufor;
}
}
}
for (i=0; i<n; i++)
cout<<tab[i]<<endl;
}
int main () {
cout << int tab(N) = ( 6, 3, 15, 9, 2 ) <<endl;
cout << int tab(N) = ( 11, 16, 8, 33, 6, 8, 1 ) <<endl;
return 0;
}