Quick actions

cmd+k|ctrl+k

Navigation

Languages

c++ 2진수로 만들기

Snippet info

Language

Cpp

Visibility

public

Author

dhrmsry7

Created

2019-01-15T14:20:02Z

Updated

2019-01-15T14:20:02Z

#include <iostream>
using namespace std;

void binary(int input) {
	for(int compare =128; compare>=1; compare /= 2){
		cout<<(input & compare ? 1:0);
		if(compare == 16)
		cout<<" ";
	}
}

int main(){
binary(120);
}

INFO