class wanghuali { private: int x; int a[1000]={0}; int m=5; public: void set(){ for(int i=0;i<5;i++){ std::cin>>x; a[x]++; } } void get(){ for(int i=0;i<1000;i++){ if(a[i]!=0){ for(int j=0;j<a[i];j++){ std::cout<<i<<" "; } } } } };
#include <iostream> #include "wanghuali.h" using namespace std; int main(){ wanghuali h; h.set(); h.get(); return 0; }
标签:排列,get,int,void,wanghuali,set,include From: https://www.cnblogs.com/guoliheng/p/17992631