描述
进制之间的转换是很常见的操作
输入
一个正整数
输出
对应的二进制
样例输入
9
样例输出
1001
#include <iostream>
#include <algorithm>
#include <stack>
using namespace std;
stack<int> s;
int main()
{
int n;
cin>>n;
while(n)
{
s.push(n%2);
n/=2;
}
while(!s.empty())
{
cout<<s.top();
s.pop();
}
return 0;
}