#include <iostream> using namespace std; int main() { int a[11]; int i,j,t; cout<<"请输入10个整数 : "<<endl; cout<<endl; for (i=1;i<11;i++) cin>>a[i]; cout<<endl; for (j=1;j<=9;j++) for (i=1;i<=10-j;i++) if(a[i]>a[i+1]) { t=a[i]; a[i]=a[i+1]; a[i+1]=t; } cout<<"从小到大排序后的十个数为: "<<endl; cout<<endl; for(i=1;i<11;i++) cout<<a[i]<<" "; cout<<endl; return 0; }
<img src="http://img.blog.csdn.net/20141231140937950?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvSV9fQW1fX0xlZ2VuZA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />
时间: 2024-10-21 01:09:55