Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- char number[32] = {}; //Initialize as empty
- void GetBinary(unsigned int input, char* output){
- memset(output, '0', 32);
- for (int i = 0; input; i++){
- output[i] = (input >> 31) + '0';
- input = input<<1;
- }
- }
- int main(){
- GetBinary(8, number);
- std::cout << number << std::endl;
- system("PAUSE>NUL");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement