Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef my_sort_razrad_hpp
- #define my_sort_razrad_hpp
- #include <stdio.h>
- #include <iostream>
- #include <cmath>
- using namespace std;
- int my_sort_razrad (int a[],int max){
- int b[max],i,maxi(0),kol(0),del,j,c,l,k,buf;
- for(i=0;i<max;i++){
- if(a[i]>maxi)
- maxi=a[i];
- }
- while(maxi!=0){
- kol++;
- maxi/=10;
- }
- for (i=1;i<(kol+1);i++){
- del=pow(10,i);
- l=0;
- for (c=0;c<10;c++){
- for(j=0;j<max;j++){
- if(abs(((a[j]/(del/10))%10))==c){
- b[l]=a[j];
- l++;
- }
- }
- }
- for(k=0;k<max;k++){
- a[k]=b[k];
- cout<<a[k]<<" ";
- }
- cout<<endl;
- }
- for(i=0;i<max;i++){
- if(a[i]<0){
- buf=a[i];
- for(j=i-1;j>=0;j--)
- a[j+1]=a[j];
- a[0]=buf;
- }
- }
- for(i=0;i<max;i++){
- cout<<a[i]<<" ";
- }
- cout<<endl;
- return *a;
- }
- #endif /* my_sort_razrad_hpp */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement