#include <cstdlib>
#include <iostream>
using namespace std;
void insercao (int n, int v[][2])
{
int j, i, x, aux;
for (j = 1; j < n; j++) {
x = v[j][1];
aux = v[j][2];
for (i = j-1; i >= 0 && v[i][1] > x; --i) {
v[i+1][1] = v[i][1];
v[i+1][2] = v[i][2];}
v[i+1][1] = x;
v[i+1][2] = aux;
}
}
int main(int argc, char *argv[])
{
int x[10][2];
x[0][1]=34; x[0][2]=0;
x[1][1]=4; x[1][2]=1;
x[2][1]=434; x[2][2]=2;
x[3][1]=3; x[3][2]=3;
x[4][1]=0; x[4][2]=4;
x[5][1]=534; x[5][2]=5;
x[6][1]=64; x[6][2]=6;
x[7][1]=48; x[7][2]=7;
x[8][1]=999; x[8][2]=8;
x[9][1]=1; x[9][2]=9;
for (int i=0;i<10;i++)
cout <<i<<" - " <<x[i][1]<<endl;
insercao(10,x);
for (int i=0;i<10;i++)
cout <<i<<" - " <<x[i][1]<<" posicao de origem: "<<x[i][2]<<endl;
system("PAUSE");
return EXIT_SUCCESS;
}