发布网友 发布时间:2022-04-26 16:32
共2个回答
热心网友 时间:2022-07-12 08:19
#include <stdio.h>
int sort(int data[],int n);
main()
{
int mat[10];
for (int i = 0; i <= 9; ++i)
scanf ("%d", &mat[i]);
sort (mat,10);
for (int j = 0; j <= 9; ++j)
printf ("%d ", mat[j]);
printf ("\n");
return 0;
}
int sort(int d[], int n)
{
int temp;
for (int i=1; i<n; i++)
{
for (int j=i-1; j>=0; j--)
{
if (d[j] > d[j+1])
{
temp = d[j];
d[j] = d[j+1];
d[j+1] = temp;
}
}
}
return 0;
}
热心网友 时间:2022-07-12 08:20
void Sort(int *a)
{
for(int i = 0; i < 9; ++i)
for(int j = i+1; i < 10; ++j)
{
Int tem;
if(a[i] > a[j])
{
tem = a[i];
a[i] = a[j];
a[j] = tem;
}
}
}