Bitset

#include <iostream>
#include <stack>
using namespace std;

int main()
{
	stack<int> s;
	int n;
	while(cin >> n)
	{
		while(n)
		{
			s.push(n % 2);
			n /= 2;
		}
		while(!s.empty())
		{
			cout << s.top();
			s.pop();
		}
		cout << endl;
	}
	
	return 0;
}

  

原文地址:https://www.cnblogs.com/mjn1/p/11294448.html