|
@ -5,11 +5,15 @@ |
|
|
#include "conversionOfNumbers.h" |
|
|
#include "conversionOfNumbers.h" |
|
|
|
|
|
|
|
|
int binaryStrLen(int input){ |
|
|
int binaryStrLen(int input){ |
|
|
int length; |
|
|
|
|
|
|
|
|
int length = 0; |
|
|
if (input == 0) return 1; |
|
|
if (input == 0) return 1; |
|
|
|
|
|
if (input < 0){ |
|
|
|
|
|
input *= -1; |
|
|
|
|
|
length += 1; |
|
|
|
|
|
} |
|
|
for (int x = 0; x <= input; x++){ |
|
|
for (int x = 0; x <= input; x++){ |
|
|
if(pow(2,x) >= input + 1){ |
|
|
if(pow(2,x) >= input + 1){ |
|
|
length = x; |
|
|
|
|
|
|
|
|
length += x; |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|