File tree 1 file changed +8
-6
lines changed
1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -26,9 +26,13 @@ int B[10];
26
26
int C[size];
27
27
int D[size];
28
28
int power=1 ;
29
- int total = 0 ;
29
+
30
30
while (power <= digits)// Get all the digits in the array
31
31
{
32
+ for (int n = 0 ; n < 10 ; ++n)
33
+ {
34
+ B[n] = 0 ;
35
+ }
32
36
for (int j=0 ; j<size; ++j)// Set digits
33
37
{
34
38
D[j] = (A[j]/((int )pow (10.0 ,power)))%10 ;
@@ -39,6 +43,7 @@ while(power <= digits)//Get all the digits in the array
39
43
{
40
44
B[D[k]]++;
41
45
}
46
+ int total = 0 ;
42
47
for (int l=0 ; l<10 ; ++l)// Do the less than equal part.
43
48
{
44
49
int temp = B[l];
@@ -47,7 +52,7 @@ while(power <= digits)//Get all the digits in the array
47
52
}
48
53
for (int m=0 ; m<size; ++m)// Actual Sorting Here
49
54
{
50
- C[B[D[m]]]= A[m];
55
+ C[B[D[m]]] = A[m];
51
56
++B[D[m]];
52
57
}
53
58
for (int n=0 ; n<size; ++n)// reset A with new sorted part
@@ -56,10 +61,7 @@ while(power <= digits)//Get all the digits in the array
56
61
C[n] = 0 ;
57
62
D[n] = 0 ;
58
63
}
59
- for (int n = 0 ; n < 10 ; ++n)
60
- {
61
- B[n] = 0 ;
62
- }
64
+
63
65
++power;
64
66
}
65
67
You can’t perform that action at this time.
0 commit comments