Skip to content

Instantly share code, notes, and snippets.

@Kylmakalle
Created September 14, 2017 21:12
Show Gist options
  • Save Kylmakalle/90b6b71b5a3ff6a605fba5a5d603b452 to your computer and use it in GitHub Desktop.
Save Kylmakalle/90b6b71b5a3ff6a605fba5a5d603b452 to your computer and use it in GitHub Desktop.
void binary_form(int TYPE) {
int z;
for (char j = sizeof(int) * 8 - 1; j >= 0; j--) {
z = ((int)1) << j;
if ((TYPE & z) != 0)
std::cout << 1;
else
std::cout << 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment