# include
using namespace STD;
void insert_sort (int * X, int N)
{< br> int I, j, T;
for (I = 1; I {< br>/*
Number of saved subscript I. Note: The subscript starts from 1. The reason is that
the first number is the number of subscripts with 0. There is no number in front of it,
It is sorted in order.
*/
T = * (x + I);
for (j = I-1; j> = 0 & T <* (x + J); -- j)/* Note: J = I-1, j --, here is the number of Subscripts for I, there is a sequence before it to find the insert position. */
{< br> int TEM;
TEM = * (x + J + 1);
* (x + J + 1) = * (x + J);/* if the conditions are met, move back. The worst case is that t is smaller than the number of 0 subscripts. It should be placed at the beginning, j =-1, exit the loop */
* (x + J) = TEM;
}< BR >}
int main ()
{< br> int N, * a;
cout <"Please enter N:" CIN> N;
A = new int (n);
cout <"Please enter n numbers:" for (INT I = 0; I CIN> A [I];
insert_sort (A, N );
cout <"the sorted numbers:" for (I = 0; I cout cout return 0;
Delete;
}< br>