垃圾基数排序
真的很垃圾啊
class cmp{ int base; public: cmp(int pos=0):base(pos){} bool operator() (const int &a,const int & b){ return (a/(int)pow(10,base))%10<(b/(int)pow(10,base))%10; } }; int main(){ int a[10]; for(auto& x:a){ x=rand(); } for(int i=0;i<10;++i){ sort(a,a+10,cmp(i)); for(auto&x:a){ cout<<x<<' '; } cout<<endl; } return 0; }