Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using namespace std;
- int main()
- {
- int n,ch,s,a[n];
- cout<<"n =";
- cin>>n;
- for (s=0;s<n;s++){
- cout<<"a["<<s<<"]= ";
- cin>>ch;
- a[s]=ch;
- }
- int m=a[0];
- for (int i=1;i<n;i++){
- if (a[i]>m){
- m=a[i];
- }
- }
- int b[m+1];
- for (int i=0;i<m+1;i++){
- b[i]=0;
- }
- for (int i=0;i<n;i++){
- int ind=a[i];
- b[ind]+=1;
- }
- int c[100],q;
- for(int j=0;j<m+1;j++){
- for(int k=0,q=0;k<b[j] && q<n;k++,q++){
- c[q]=j;
- cout<<c[q];
- }
- }
- }
Add Comment
Please, Sign In to add comment