#include
int main()
{
double a[20],t;
int n,i,j;
n=20;
printf("请输入%d个实数:\n",n);
for(i=0;i scanf("%lf",&a[i]); printf("\n"); for(j=0;j<(n-1);j++) /*进行n-1次循环,实现n-1趟比较*/ for(i=0;i<(n-1-j);i++) /*在每一趟中进行n-1-j次比较*/ if(a[i]>a[i+1]) /*相邻两个数比较*/ {t=a[i];a[i]=a[i+1];a[i+1]=t;} printf("经过排序后的数字为:\n"); for(i=0;i printf("%g ",a[i]); printf("\n"); return 0; }