3.代码示例
#include<iostream> #define N 10 using namespace std; int main(){ int a[N]; int i,j,t; for(i=0;i<N;i++){ cin>>a[i]; } for(i=0;i<N-1;i++){ for(j=0;j<N-1;j++){ if(a[j]>a[j+1]){ t=a[j]; a[j]=a[j+1]; a[j+1]=t; } } } for(i=0,j=1;i<N;i++,j++){ cout<<a[i]<<" "; } return 0; }
4.输出结果
标签:std,10,Day8,示例,int,main From: https://www.cnblogs.com/cream867/p/17334966.html