#### If you want to arrange a group of out-of-order numbers, insert a group of numbers into the ascending sequence.

Now every time I output, I will lose the largest item and get more zeros. How do I solve it?

``````# include<cstdio>
# include<cstdlib>

long long int a[1000];
long long int c[1000];

void sort(long long int as[],long long int left,long long int right)
{
if(left<right)
{
int i = left;
int j = right;
int x = as[i];

while(i<j)
{
while(i<j&&as[j]>x)
j--;
if(i<j){
as[i] = as[j];
i++;
}
while(i<j&&as[i]<x)
i++;
if(i<j){
as[j] = as[i];
j--;
}
}
as[i] = x;
sort(as,left, i-1);
sort(as,i+1, right);
}
}

{
printf("\aPlease input the number of the integers you want to add to the origin array:\n");
{
}
{
}

long long int addposition = 1;
long long int aposition = 1;
long long int totalnum;

printf("The final array is:\n");

for (i=1;  i<=totalnum-5;  i++)
{
{
}
{
i++;
aposition++;
}
{
printf("%lld ",a[aposition]);
aposition++;
}
}
printf("\n");
return;
}

int main()
{
long long int i,j,num;
printf("\aPlease input the number of the integers in the origin arrray:\n");
scanf("%lld",&num);
printf("\aPlease input the integers in the origin array one by one:\n");
for (i=1;  i<=num;  i++)
{
scanf("%lld",&a[i]);
}
sort(a,1,num);
system("pause");
return 0;
}``````

The second for in addsort should be changed to the following, logically wrong attitude, compare the code yourself.

``````for (i=1;  i<=totalnum;  i++)
{
if (aposition > num)
{
{
printf("%lld ",a[aposition]);
aposition++;
{