깡다구짱
2015. 12. 2. 00:39
#include <iostream>
#define SIZE 10
using namespace std;
int main()
{
int a[SIZE] = {45,2,46,87,34,12,34,5,9,100};
int i;
for(i = 0 ; i < SIZE ; i++)
{
int Current = i;// 4
int Temp = a[i];// 34
for(; (Current > 0) && (a[Current-1] > Temp) ; Current--){
a[Current] = a[Current-1];
cout<<"("<<a[Current]<<")"<<endl;
}
a[Current] = Temp;
}
for(int j = 0 ; j < SIZE ; j++)
{
cout<<a[j]<<endl;
}
system("pause");
return 0;
}