鲜花主题咖啡店:C语言编程

来源:百度文库 编辑:杭州交通信息网 时间:2024/05/05 05:17:01
编写一个C程序,输入20个数,按降序输出。

void sort(double a[20])
{
double temp=0;
for(int i=0;i<20;i++)

for(int j=i;j<20;j++)

if(a[i]>a[j])
{
temp=a[i];
a[i]=a[j];
a[j]=temp;
}//end of if
}//end of the inner circle
}//end of the outside circle

//接着依次输出数组中的数
for(int i=0;i<20;i++)

printf("lf%",a[i]);
}
}

祝你好运!