标签:sans define new pre wap div space tmp ++
#include<iostream> #include<cstring> #define N 500+10 using namespace std; int a[N],n; int main() { cin>>n; for(int i=1;i<=n;i++)cin>>a[i]; for(int i=1;i<n;i++) { int tmp=i; for(int j=i+1;j<=n;j++) if(a[j]<a[tmp]/*就是判断条件*/)tmp=j; swap(a[i],a[tmp]); } for(int i=1;i<=n;i++)cout<<a[i]<<" "; cout<<endl; return 0; }
标签:sans define new pre wap div space tmp ++
原文地址:https://www.cnblogs.com/jzxnl/p/11070341.html