杨家坪C++1901班的程序备份

JupHamaster 木星拜 2021-09-20 15:51:35 1

#9.20

#include <bits/stdc++.h>

using namespace std;
int a[110] = {'0'};
int idx = -1;

//出栈 
char pop()
{
	idx--;
	return a[idx+1];
}

//压栈
void push(int x)
{
	idx++;
	a[idx] = x;
}

int main(void)
{
	int n;
	cin >> n;
	while (n!=0)
	{
		int mod = n%16;
		if(mod>=10)
			mod = 'A'+mod-10;
		else
			mod = '0'+mod;
		push(mod);
		N=N/16;
	}
	while(idx>=0)
	{
		cout<<pop();
	}
} 
a = int (input())
ls = list()
while a!=0:
    ls.append(a%2)
    a//=2
for i in range(len(ls)):
    print(ls.pop(),end='')
print("\n")
{{ vote && vote.total.up }}