Hi.
I was studying c++, instructor skipped creating sort function and used the one in algorithm library saying creating it needs programming techniques I don't know right now.
So I tried to code it myself. I think in theory my function would do the same to int vectors. the one for strings also should just be more time consuming because of texts sharing same sub-strings.
But when I compile it the program crashes.
I would appreciate any help.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
void sorter(vector<int> &vect)
{
int temp;
for (int i=0; i<vect.size()-1; i++) {
for (int j=0; i<vect.size()-1; j++) {
if (vect[j] > vect[j+1]) {
temp=vect[j];
vect[j]=vect[j+1];
vect[j+1]=temp;
}
}
}
}