Witam!
Chciałbym dowiedzieć się jaki problem występuje w tym kodzie. W build log nie ma żadnych błędów.Chodzi o to, że po wypisaniu tablicy nie uporządkowanej konsola się zamyka.
#include <iostream>
#include <time.h>
#include <windows.h>
using namespace std;
void sortowanie(int *tab, int lewy, int prawy)
{
int S = tab[(lewy+prawy)/2];
int bufor;
int l=lewy;
int p=prawy;
do
{
while(tab[l]<S)
l++;
while(tab[p]>S)
p++;
if(l<=p)
{
bufor=tab[l];
tab[l]=tab[p];
tab[p]=bufor;
l++;
p--;
}
}
while(l<=p);
if(p>lewy)
sortowanie(tab,lewy, p);
if(l<prawy)
sortowanie(tab, l, prawy);
}
int main()
{
srand(time(0));
int ile;
cout<<"ile liczb: ";
cin>>ile;
int* tab;
tab= new int[ile];
for(int i=0; i<=ile-1; i++)
{
tab[i]=rand()%100+1;
}
for(int i=0; i<=ile-1; i++)
{
cout<<tab[i]<<" ";
}
sortowanie(tab, 0, ile-1);
for(int i=0; i<=ile-1; i++)
{
cout<<tab[i]<<" ";
}
delete [] tab;
return 0;
}