Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - The holistic thinking of plastic surgery
The holistic thinking of plastic surgery
/* The whole idea is to arrange the ten input numbers from small to large, and then compare the size of each input number with the array and insert it into the array. This part is the key. It should be noted that we defined the length of the array as 1 1 from the beginning, that is, the space reserved for inserting a number after it */

# include & ltstdio.h & gt

void main()

{

int a[ 1 1]; /* The length of the array is 1 1*/

int n= 10,I,j,k,t;

int x,count

Printf ("Please enter ten integers: \ n");

for(I = 0; I< 10; i++)

scanf("%d ",& ampa[I]);

for(I = 0; I<9; I++) /* Arrange the ten numbers entered by the selection method */

{

k = I;

for(j = I+ 1; j & lt 10; j++)

if(a[j]& lt; a[k])

k = j;

If (k! =i)

{

t = a[I];

a[I]= a[k];

a[k]= t;

}

}

for(I = 0; I< 10; I++) /* Output the arranged ten numbers */

printf("%d ",a[I]);

printf(" \ n ");

Printf ("Please enter any integer: \ n");

scanf("%d ",& ampx);

for(I = 0; I< 10; I++) /* Compare the input number x with the array elements */{

if(x & lt; a[i])

{

for(j = 10; J> me; j -)

a[j]= a[j- 1];

a[I]= x;

Break;

}

}

for(I = 0; I< 1 1; I++) /* Output the final result */

printf("%d ",a[I]);

printf(" \ n ");

}