Jako świeżak w temacie powiedzcie mi jak powinien wyglądać poprawny kod? Co pominąłem i powinienem dodać lub zamienić?
#include <iostream>
using namespace std;
void sort(double* lista, int n) {
double space = n, temp = 0;
bool next_i = true;
while (space > 1 || next_i){
space = space / 1.3;
if(space==0)
space=1;
next_i = false;
for (int i=0; i + space < n; ++i) {
if (tab[i + space] < tab[i]) {
temp = lista[i];
lista[i] = lista[i + space];
lista[i + space] = temp;
next_i = true;
}
}
}
}
int main () {
int n;
cin >> n;
double* L = new double[n];
for(int i = 0; i < n; i++)
cin >> L[i];
sort(L, n);
for(int i = 0; i < n; i++)
cout << L[i] << " ";
delete[] L;
system("pause");
return 0;
}
Błędy, które mi wyskakiwały: