Mam problem z kodem
Teoretycznie jak go czytam wygląda, że działa.
Próbowałem go zmieniać na różne sposoby, jednak to nic nie daje
#include <iostream>
#include <vector>
using namespace std;
vector <int> tab;
bool sp(vector <int> tab[]){
unsigned int l=tab.size();
for(int i=0;i<tab.size();i++)
if(tab[i]>tab[i+1])
return false;
return true;
}
void sb(vector <int> tab[]){
int l=tab.size();
while(sp(tab[])==false){
for(int i=0;i<tab.size();i++)
if(tab[i]>tab[i+1]){
int temp=tab[i+1];
tab[i+1]=tab[i];
tab[i]=temp;
}
}
}
void wys(vector <int> tab[]){
int l=tab.size();
for(int i=0;i<l;i++)
cout << " "<< tab[i] <<" ";
cout<< endl;
}
int main()
{
int q1,q;
cout << "Ile liczb do tablicy ?" << endl;
cin >>q1;
for(int i=0;i<q1;i++){
cout << "Podaj liczbe nr "<<i<<" do tablicy" << endl;
cin >>q;
tab.push_back(q);
}
wys(tab[])
cout << "/\\ bez sort /\\" << endl;
sb(tab);
wys(tab);
cout << "/\\ po sort /\\" << endl;
system("pause");
return 0;
}
Jeśli to ma znaczenie programuje w Code::Blocks 20.03.