You are on page 1of 1

# include <stdio.

h>
# include <stdlib.h>
# include <iostream>
#include <locale.h>
using namespace std;

void insertSort(int x[], int tam){


int j,i,pivot;
for(i=1; i < tam;i++){
j=i-1;
pivot=x[i];
while(j>-1 && x[j]>pivot){
x[j+1]=x[j];
j--;
}
x[j+1]=pivot;
}
}

void ver(string nomearray,int x[], int tam){


cout << endl << nomearray << "::";
int i;
for(i=0; i < tam-1;i++){
cout << x[i] << "-";
}
cout << x[i] << endl;
}

int main(){
int xpto[]={5,4,2,1,3};
ver("xpto",xpto,5);
insertSort(xpto,5);
ver("xpto",xpto,5);
system("pause");
}

ur gay boi i wont delete doe xuxu <3

You might also like